Aggressive Pullback Indicator
This simple pullback indicator was created for Steven Hart’s Aggressive Pullback Strategy. It was one of the first scripts I ever made, and for a long time it was a trading tool I used every single day in conjunction with my ATR Stop Loss indicator.
It sends you pullback alerts and draws your stops and targets for you which makes backtesting and trade execution a lot faster.
This is an extremely powerful strategy when used with the right rules. I will not divulge my trading strategy rules here as they are too long and too valuable to share for free.
But if you are an experienced trader who has traded rules-based systematic trading strategies before then I have no doubt that you will be able to come up with profitable rules to trade these signals. If you need help coming up with ideas or understanding the process behind rules-based strategy development then I encourage you to check out my trading mentor’s education course The EAP Program.
If you like this basic pullback indicator then you may want to try out my updated and advanced version of this script which I currently use to trade the forex markets – The Ultimate Pullback Indicator.
How It Works
I will detail the basics as best I can, but if you want to learn the specific rules that I personally use with this indicator then you can sign up to my mentor Steven Hart’s EAP training program at TheTradingChannel.net.
When price is above the 50-EMA (Exponential Moving Average), the script begins looking for Long signals. When price is below the 50-EMA, the script begins looking for Short signals.
The trading signals are generated by engulfing candles.
For Long trades price must be above the 50-EMA then pull back at least 2 candles before putting in a bullish engulfing candle.
For Short trades price must be below the 50-EMA then pull back at least 2 candles before putting in a bearish engulfing candle.
The Stop Loss is set as 1ATR above/below swing high/lows (from the candle close). The Take Profit is 1ATR above/below the entry price (by default).
Some of these settings can be adjusted if you want to test variations of these parameters.
You can adjust the length of the Exponential Moving Average with this setting.
Stop Distance (ATR):
This value is treated as an ATR multiplier.
Reward To Risk Ratio (Stop Loss x ?):
This setting will determine your profit-target distance. It is calculated based on your stop loss, so if you have a 20 pip stop loss and this is set to 3, then your take profit price will be drawn 60 pips above your entry candle.
// Created by Matthew J. Slabosz // www.zenandtheartoftrading.com // @version=3 study(title = "[ZEN] Aggressive Pullback Indicator", shorttitle="API", overlay = true, precision=5) // Get user input emaLength = input(title="EMA Length:", defval=50, minval=1) stopSizeInput = input(title="Stop Distance (ATR):", defval=1.0, minval=0.0) riskToReward = input(title="Reward To Risk Ratio (Stop Loss X ?):", defval=1.0, minval=0.1) // Get EMA ema = ema(close, emaLength) currentATR = atr(14) // Calculate stop loss info decimals = abs(log(syminfo.mintick) / log(10)) stopSize = currentATR * stopSizeInput // SL and Target variables tradeStopPrice = 0.0 tradeTargetPrice = 0.0 longEntrySize = (close - lowest(low, 5)) + stopSize shortEntrySize = (highest(high, 5) - close) + stopSize // Plot data plot(ema, title="EMA", color=red, transp=0, linewidth=1) // Validate long signals rule1L = (close > ema and (open > close and close > open and close >= open and close >= open and close - open > open - close)) // Bullish engulfing? rule2L = open < open // Satisfies pullback rule? rule3L = close < open // Satisfies maximum engulfing rule? rule4L = close < highest(open, 5) // Satisfies swing high and ATR validation? rule5L = highest(high, 5) > ema and (high > ema or high > ema) // Make sure the past 2 candles have at least touched or stayed above the ema, cleans up some invalid signals rule6L = close > ema and (close > ema or close > ema) // Make sure no more than 1 candle has recently closed below EMA validLong = rule1L and rule2L and (rule3L or rule4L) and rule5L and rule6L // Draw long signal only if rules are met plotshape(validLong, title= "Bullish Engulfing", location=location.belowbar, color=green, transp=0, style=shape.triangleup, text="") // Validate short signals rule1S = (close < ema and (close > open and open > close and open >= close and open >= close and open - close > close - open)) // Bearish engulfing? rule2S = open > open // Satisfies pullback rule? rule3S = close > open // Satisfies maximum engulfing rule? rule4S = close > lowest(open, 5) // Satisfies swing low and ATR validation? rule5S = lowest(low, 5) < ema and (low < ema or low < ema) // Make sure the past 2 candles have at least touched or stayed below the ema, cleans up some invalid signals rule6S = close < ema and (close < ema or close < ema) // Make sure no more than 1 candle has recently closed above EMA validShort = rule1S and rule2S and (rule3S or rule4S) and rule5S and rule6S // Draw short signal only if rules are met plotshape(validShort, title= "Bearish Engulfing", color=red, transp=0, style=shape.triangledown, text="") // Activate long flag and store position info if(validLong) tradeStopPrice := close - longEntrySize tradeTargetPrice := close + (longEntrySize * riskToReward) // Activate short flag and store position info if(validShort) tradeStopPrice := close + shortEntrySize tradeTargetPrice := close - (shortEntrySize * riskToReward) // Convert stop sizes to whole number for display purposes if(decimals == 5) longEntrySize := longEntrySize * 10000 shortEntrySize := shortEntrySize * 10000 if(decimals == 4) longEntrySize := longEntrySize * 1000 shortEntrySize := shortEntrySize * 1000 if(decimals == 3) longEntrySize := longEntrySize * 100 shortEntrySize := shortEntrySize * 100 if(decimals == 2) longEntrySize := longEntrySize * 10 shortEntrySize := shortEntrySize * 10 // Draw stops & targets plot((validLong or validLong) ? (validLong ? tradeStopPrice : tradeStopPrice) : na, title="Long Stop Price", color=red, style=linebr, transp=0) plot((validShort or validShort) ? (validShort ? tradeStopPrice : tradeStopPrice) : na, title="Short Stop Price", color=red, style=linebr, transp=0) plot((validLong or validLong) ? (validLong ? tradeTargetPrice : tradeTargetPrice) : na, title="Long Target Price", color=green, style=linebr, transp=0) plot((validShort or validShort) ? (validShort ? tradeTargetPrice : tradeTargetPrice) : na, title="Short Target Price", color=green, style=linebr, transp=0) // Send out an alert if this candle meets our conditions alertcondition(validLong or validShort, title="API Alert!", message="Trend continuation signal for XXX")
Last Updated: 8th May, 2019