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
A long needs price to touch or dip under the EMA, close back above it on a sufficiently large green candle, with the EMA above a 100-period EMA and a minimum pullback percentage. Shorts mirror this. Optional filters cover MACD, volume, a stochastic and a session window in Sao Paulo time. Stops go below the candle wick or at a percentage, and targets use a ratio or percentage. Sizing is percent of equity.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Enable Long Positions
bool
true
enableLong
Enable Short Positions
bool
true
enableShort
Use MACD Filter
bool
false
useMacdFilter
MACD Fast Length
int
12
macdFastLength
MACD Slow Length
int
26
macdSlowLength
MACD Signal Length
int
9
macdSignalLength
Minimum MACD Size
float
0
macdMinSize
EMA Length
int
15
emaLength
EMA200 Length
int
100
ema200Length
Show EMA
bool
true
showEma
Use Trend Filter
bool
true
useTrendFilter
Show Debug Info
bool
true
showDebug
Show all 36 settings
Setting
Type
Default
Variable
Pullback Percentage
float
0.1
pullbackPct
Candle Size Type
string
Percentage
candleSizeType
Minimum Candle Size
float
0.7
minCandleSize
Stop Loss Type
string
Below Candle Wick
slType
Stop Loss %
float
10.0
slPercent
Stop Loss Buffer %
float
0.0
slBuffer
Take Profit Type
string
Percentage
tpType
Take Profit %
float
2.0
tpPercent
Risk/Reward Ratio
float
2.0
rrRatio
Use Session Time Filter
bool
true
useSessionFilter
Trading Session (São Paulo Time)
session
1000-1700
sessionTime
Session Timezone
string
America/Sao_Paulo
sessionTimeZone
Use Volume Filter
bool
true
useVolumeFilter
Minimum Volume Multiplier
float
1.5
minVolume
Use Stochastic Filter
bool
false
useStochFilter
Stochastic Length
int
21
stochLength
Stochastic Overbought
int
80
stochOverbought
Stochastic Oversold
int
20
stochOversold
Use RSI Divergence Filter
bool
false
useRsiDivergence
RSI Length
int
14
rsiLength
Divergence Lookback Bars
int
20
divergenceLookback
RSI Overbought Level
float
70
rsiOverbought
RSI Oversold Level
float
30
rsiOversold
Min Divergence Strength %
float
2
minDivergenceStrength
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.
Doge SMA is a long-only moving-average crossover strategy drawn on the price chart. It calculates a fast and a slow simple moving average of close and enters a long position when the fast average crosses above the slow average, but only inside a user-defined s
This strategy calculates and plots a fast Exponential Moving Average (EMA) and a slow EMA directly on the main price chart. It enters long trades when the fast EMA crosses above the slow EMA and exits when the fast EMA crosses below the slow EMA. Inputs allow
2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the
This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can
This strategy calculates dynamic support and resistance levels using pivot highs and lows alongside a custom smoothed trend filter and a 3-period EMA. It identifies entry opportunities when price breaks out relative to the trend filter and short-term EMA cross
EMA Crossover Strategy plots a fast and a slow exponential moving average on the price chart. It treats a confirmed fast-over-slow cross as a long condition and a confirmed cross under as a short condition. Position size is a percentage of equity. Optional per