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
The fast and slow averages and the signal line can each use SMA or EMA. Optional markers show MACD and signal crosses. Pivot lookbacks scan the oscillator for regular and hidden bullish and bearish divergences, with a toggle for each type. Two EMAs compare a faster and slower trend. A take-profit factor and bars-back setting are present, but the supplied code ends before entry, exit, and stop rules are defined.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Source
source
close
src
Fast Length
int
12
fast_length
Slow Length
int
26
slow_length
Signal Smoothing
int
9
signal_length
Oscillator MA Type
string
EMA
sma_source
Signal Line MA Type
string
EMA
sma_signal
MACD Line
color
#2962FF
col_macd
Signal Line
color
#FF6D00
col_signal
Show Signals&MACD Cross
bool
true
showCross
Above Grow
color
#00796b
col_grow_above
Fall
color
#26a69a
col_fall_above
Below Grow
color
#ef5350
col_grow_below
Show all 26 settings
Setting
Type
Default
Variable
Fall
color
#b71c1c
col_fall_below
Don't touch the zero line?
bool
true
donttouchzero
Pivot Lookback Right
int
5
lbR
Pivot Lookback Left
int
5
lbL
Max of Lookback Range
int
60
rangeUpper
Min of Lookback Range
int
5
rangeLower
Plot Bullish
bool
true
plotBull
Plot Bearish
bool
true
plotBear
Plot Hidden Bullish
bool
false
plotHiddenBull
Plot Hidden Bearish
bool
false
plotHiddenBear
EMA 1
int
150
maA
EMA 2
int
600
maB
Bars back
int
10
barsBack
Take profit factor
float
1.5
tpFactor
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 implements Bill Williams' Awesome Oscillator (AO) calculated as the difference between two simple moving averages of the median price. It generates long and short entries using three classic signal triggers: zero-line crossovers, twin peaks diver
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
Divergenced B004 is a Pine Script strategy that plots on the price chart and looks for divergences in the Squeeze Momentum Indicator. It shorts when a green-section squeeze value falls while price rises, and longs when a red-section squeeze value rises while p
This strategy executes long positions by combining a 200-period EMA trend filter, Stochastic RSI oversold crosses, and Williams Alligator retracements, supplemented by RSI divergence detection. It triggers long entries when the price trades above the 200 EMA w
This strategy calculates the Moving Average Convergence Divergence indicator and plots the MACD line, signal line, and histogram in a separate pane. It enters long positions when the MACD line crosses above the signal line and enters short positions when it cr
8D Run is a Pine Script momentum strategy inspired by Linda Bradford Raschke. It tracks consecutive price closes relative to a 5-period Simple Moving Average (SMA). When price remains above the SMA for 8 or more bars and then dips below it, the strategy enters