This strategy looks for three-candle patterns, namely the 123 pattern, PFR and engulfing candles, filtered by a trend of stacked EMAs, and adds an optional RSI divergence filter drawn as lines on the price chart.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
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
Further optional filters use volume and a stochastic. Candle size rules are adjustable. Stop loss can sit below the candle body or wick, at a percentage or at a recent low, with take profit set by a risk-reward ratio or a percentage. It sizes positions by percent of equity.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Use RSI Divergence Filter
bool
false
useRsiDivFilter
RSI Length
int
14
rsiLength
RSI Divergence Lookback
int
20
rsiDivLookback
Bullish Divergence Color
color
color.green
bulldivcol
Bearish Divergence Color
color
color.red
beardivcol
Divergence Line Width
int
1
divwidth
Min Candle 1 Size (absolute units)
float
0.1
minCandle1Size
Min Candle 2 Body Size as % of Candle 1
float
0.1
minCandle2Pct
Max Candle 2 Body Size as % of Candle 1
float
0.5
maxCandle2Pct
Min Candle 3 Body Size as % of Candle 1
float
0.6
minCandle3Pct
Max Candle 3 Body Size as % of Candle 1
float
1.5
maxCandle3Pct
Enable Long Positions
bool
true
enableLong
Show all 38 settings
Setting
Type
Default
Variable
Enable Short Positions
bool
true
enableShort
Use Trend Filter
bool
true
useTrendFilter
Use Volume Filter
bool
false
useVolumeFilter
Minimum Volume Multiplier
float
1.5
minVolume
Use Stochastic Filter
bool
false
useStochFilter
Stochastic Length
int
21
stochLength
Stoch Overbought
float
50
stochOverbought
Stoch Oversold
float
50
stochOversold
Take Profit Type
string
RR-Based
tpType
Take Profit Ratio (vs SL)
float
1.0
profitTargetRR
Take Profit % From Entry
float
1.0
tpPercent
Stop Loss Type
string
Below Candle Wick
slType
Stop Loss %
float
1.0
slPercent
Number of Candles for Lowest Low
int
10
slCandlesLookback
Price Comparison Buffer (%)
float
0.001
priceBufferPct
Enable 123 Pattern
bool
true
enable123
Enable PFR Pattern
bool
true
enablePFR
Enable Engulfing Pattern
bool
true
enableEngulfing
Use MACD Confirmation
bool
false
useMacdConfirmation
MACD Fast Length
int
12
macdFastLength
MACD Slow Length
int
26
macdSlowLength
MACD Signal Length
int
9
macdSignalLength
MA Type
string
EMA
maType
Fast MA Length
int
9
fastLength
Medium MA Length
int
40
mediumLength
Slow MA Length
int
80
slowLength
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.
This strategy enters long when a bullish candle closes above an EMA and its upper wick is no larger than a set percent of the candle range, and short on the opposite bearish setup. It closes a long after price rises a small fixed fraction above the entry bar o
This overlay strategy marks short-term turning points on the price chart and enters SPY option-style trades from them. It plots simple moving averages of highs and lows, draws up and down reversal arrows, and colors bars when a short-term extreme coincides wit
This strategy calculates and plots smoothed Heikin-Ashi candles directly onto the main price chart using exponential moving averages of open, high, low, and close prices. It enters a long position after three consecutive bullish smoothed candles with sequentia
This overlay strategy combines a Cipher B WaveTrend oscillator with two optional moving averages on the price chart. It exposes WaveTrend channel and average lengths, overbought and oversold levels, buy, sell and gold dots, and regular or hidden divergence mar
This strategy executes trades based on candlestick engulfing patterns aligned with a 200-period exponential moving average trend filter. It enters long positions when a bullish engulfing candle follows three consecutive bearish candles while price trades above
This strategy shorts the ES three-minute chart when three consecutive down candles form a triple-red pattern and price is above a Tillson-style T3 average. The average is six nested EMAs of close, combined with fixed coefficients and a user length defaulting t