The strategy calculates the Stochastic oscillator using specified K and D periods, then detects bullish and bearish divergences between price pivots and the D line.
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 signals occur when price forms lower lows while Stochastic forms higher lows within the lookback window, and bearish signals are the opposite. These are filtered by a higher timeframe EMA trend anchor. Long entries trigger on bullish divergence in a bullish regime with position sizing based on risk percentage of capital; short entries trigger on bearish divergence in a bearish regime. Stop loss and take profit are set at ATR multiples. All signals plot on the price chart. Settings primarily adjust oscillator lengths, pivot search range, HTF parameters, and risk multiples.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
K Length
int
14
periodK
K Smoothing
int
3
smoothK
D Smoothing
int
3
periodD
Pivot Left
int
5
pivotLeft
Pivot Right
int
2
pivotRight
Max Lookback (Bars)
int
60
maxLookback
Enable HTF Trend Filter
bool
true
useHTF
HTF Timeframe
timeframe
240
htfTF
HTF EMA Length
int
200
htfLen
Risk % Per Trade
float
1.0
riskPct
Stop Loss (ATR Mult)
float
2.0
slMult
Take Profit (ATR Mult)
float
4.0
tpMult
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 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 draws on the price chart and manages long and short entries around pivot trendlines. It filters signals with three configurable moving averages, Stochastic RSI, a higher-timeframe Stochastic RSI, and optional RSI divergence. A session window can
This strategy plots a range filter and high and low target bands on the price chart, and colors bars from filter direction. Inputs cover a backtest date window, WaveTrend Cipher B channel and average lengths, overbought and oversold levels, divergence threshol
The TQQQ MA+TSI strategy executes trades based on triple simple moving average alignment combined with True Strength Index (TSI) divergence or momentum filters. Designed primarily for intraday stock trading, it evaluates price accumulation across fast, mid, an
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
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