Strategy · Pine Script v5 · On the chart

ZigZag PA Strategy

by merdunal

This strategy builds a zigzag from candle direction flips, optionally on an alternate timeframe (60 by default) or Heikin Ashi candles.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code343
Settings28inputs
LicenceNone stated
Last update2 years ago29 Nov 2023

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

From the last five zigzag points it measures XABCD ratios to flag harmonic patterns such as Bat, Butterfly and ABCD, and plots Fibonacci levels. Trades use Fibonacci rates for the entry window, take profit and stop loss, with two optional targets and alert comments. The alternate timeframe request uses lookahead, so results can differ from live trading. It draws on the price chart.

Details

Published by

merdunal on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time
  • The strategy enters trades without a stop loss

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Use Heikken Ashi CandlesboolfalseuseHA
Use Alt TimeframebooltrueuseAltTF
Alt Timeframestring60tf
Show PatternsbooltrueshowPatterns
Display Fibonacci 0.000:booltrueshowFib0000
Display Fibonacci 0.236:booltrueshowFib0236
Display Fibonacci 0.382:booltrueshowFib0382
Display Fibonacci 0.500:booltrueshowFib0500
Display Fibonacci 0.618:booltrueshowFib0618
Display Fibonacci 0.764:booltrueshowFib0764
Display Fibonacci 1.000:booltrueshowFib1000
Target 1 - Trade size:float10000.00target01_trade_size
Show all 28 settings
SettingTypeDefaultVariable
Target 1 - Fib. Rate to use for Entry Window:float0.236target01_ew_rate
Target 1 - Fib. Rate to use for TP:float0.618target01_tp_rate
Target 1 - Fib. Rate to use for SL:float-0.236target01_sl_rate
Target 2 - Active?boolfalsetarget02_active
Target 2 - Trade size:float10000.00target02_trade_size
Target 2 - Fib. Rate to use for Entry Window:float0.236target02_ew_rate
Target 2 - Fib. Rate to use for TP:float1.618target02_tp_rate
Target 2 - Fib. Rate to use for SL:float-0.236target02_sl_rate
target01 Buy Entry Messagestringtarget01_buy_entry_comment
target01 Buy Close Messagestringtarget01_buy_close_comment
target01 Sell Entry Messagestringtarget01_sel_entry_comment
target01 Sell Close Messagestringtarget01_sel_close_comment
target02 Buy Entry Messagestringtarget02_buy_entry_comment
target02 Buy Close Messagestringtarget02_buy_close_comment
target02 Sell Entry Messagestringtarget02_sel_entry_comment
target02 Sell Close Messagestringtarget02_sel_close_comment
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr

Strategy v6 BreakoutTrend
Updated yesterday · AGPL-3.0 GitHub repository of Forven S01509 - Simple Donchian 20/10 Breakout
257 stars

This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos

Strategy v6 TrendMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of Best Chart 1m Strategy Candle Bar

STRG-HOLP

by harryguiacorn
220 stars

STRG-HOLP is a trading strategy that identifies High of Low Period (HOLP) and Low of High Period (LOHP) breakout setups. It tracks the lowest low or highest high over a user-defined lookback window. A long trade opens when the close breaks above the high of th

Strategy v5 BreakoutSupport & resistance
Updated 1 year ago · None stated GitHub repository of STRG-HOLP
106 stars

This script monitors opening gap conditions and breakout behavior relative to the first candle's range across up to twenty configurable stock tickers. It detects whether following bars remain inside the opening range before breaking out, displaying the status

Strategy v4 Screeners & dashboardsBreakout Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 1St Bar GAP+BkOut Screener v2 by RM

This trend breakout strategy plots Donchian Channels consisting of upper, lower, and middle bands directly on the main price chart. Long positions enter when price touches the upper channel and pulls back to or below the middle band, placing a stop loss at the

Strategy v6 TrendBreakout
Updated 2 months ago · MPL-2.0 GitHub repository of Donchian Strategy - Dynamic TP, Fixed SL, 1% Risk, Daily Target

More Support & resistance scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers