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
Bullish divergences trigger long entries when price forms lower lows while %D forms higher lows. Bearish divergences trigger short entries on higher highs with lower %D lows. Entries use position sizing from equity with optional percentage-based stop loss and take profit. Key settings control Stochastic periods, divergence sensitivity, OB/OS levels, line colors, visibility, and alert styles. It can remove broken divergences and provides visual cues for reversals.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Contracts per Trade
int
1
i_lotSize
Use Stop Loss
bool
true
i_useSL
Stop Loss (%)
float
2.0
i_slPerc
Use Take Profit
bool
true
i_useTP
Take Profit (%)
float
4.0
i_tpPerc
%K Length
int
14
i_periodK
%K Smoothing
int
1
i_smoothK
%D Smoothing
int
3
i_periodD
Overbought Level
int
80
i_obLevel
Oversold Level
int
20
i_osLevel
Middle Level
int
50
i_midLevel
Show %K Line
bool
true
i_showK
Show all 31 settings
Setting
Type
Default
Variable
Show %D Line
bool
true
i_showD
Rising Color
color
color.green
i_colUp
Falling Color
color
color.red
i_colDown
Sideways Color
color
color.white
i_colSide
Bullish Div Color
color
#4caf50
i_colBullDiv
Bearish Div Color
color
#f23645
i_colBearDiv
Show OB/OS Alerts
bool
true
i_showAlerts
OB Style
string
Circle
i_alertOBstyle
OS Style
string
Circle
i_alertOSstyle
OB Alert Color
color
color.red
i_alertOBcol
OS Alert Color
color
color.green
i_alertOScol
Show Divergences
bool
true
i_showDiv
Pivot Lookback Left
int
5
i_pivotLookbackL
Pivot Lookback Right
int
5
i_pivotLookbackR
Max Bars to Look Back
int
100
i_maxBarsBack
Remove Broken Divergences
bool
true
i_removeBrokenDiv
Divergence Line Width
int
3
i_divLineWidth
Show Divergence Labels
bool
true
i_showDivLabels
Show Performance Report
bool
true
i_showReport
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.
MACD + Divergences [Alorse] is a momentum strategy that calculates the MACD oscillator and identifies regular and hidden divergences using pivot high and low points. It filters trade signals with dual Exponential Moving Averages (EMA 150 and 600) to ensure tra
The Stochastic Divergence Strategy calculates the Stochastic oscillator (%K and %D) to identify regular bullish and bearish divergence patterns against price pivots. It plots the oscillator and divergence lines in a separate indicator pane. Entries trigger on
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 strategy calculates regular and hidden divergences across selectable momentum oscillators, including RSI, CCI, and MFI, and plots volatility-based divergence zones. It displays oscillator dynamics in a separate pane while projecting support and resistance
This strategy combines a WaveTrend oscillator with a dual-period RSI differential to generate trend-following entries in a separate indicator pane. It calculates fast and slow RSI values, alongside WaveTrend channel lines and overbought or oversold thresholds.
A trading strategy that uses an RSI state machine tracking 50-level crossovers, pullbacks, and hidden divergences. Entries require confirmation from optional confluence filters, including an EMA touch, Fibonacci retracement zones, and Ichimoku cloud conditions