Strategy · Pine Script v6 · On the chart

TN Stochastic Causal Divergence

by raybird

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.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code100
Settings12inputs
LicenceNone stated
Last update2 months ago15 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 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.

Details

Published by

raybird on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Oscillators & momentum, Divergence, Moving averages, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
K Lengthint14periodK
K Smoothingint3smoothK
D Smoothingint3periodD
Pivot Leftint5pivotLeft
Pivot Rightint2pivotRight
Max Lookback (Bars)int60maxLookback
Enable HTF Trend FilterbooltrueuseHTF
HTF Timeframetimeframe240htfTF
HTF EMA Lengthint200htfLen
Risk % Per Tradefloat1.0riskPct
Stop Loss (ATR Mult)float2.0slMult
Take Profit (ATR Mult)float4.0tpMult
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.

Similar Pine Scripts

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

Strategy v4 TrendOscillators & momentum
Updated 3 years ago · Apache-2.0 GitHub repository of 200 EMA + Alligator + Stochastic Long Strategy

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

Strategy v5 TrendOscillators & momentum Repaints
Updated 5 months ago · None stated GitHub repository of Pivot Trendlines with Divergence Scanner Strategy

MML Multi Indikator Script

by theupslidedown
2 stars

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

Strategy v4 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of MML Multi Indikator Script

TQQQ MA+TSI

by yalili8521
2 stars

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

Strategy v6 TrendOscillators & momentum
Updated 7 days ago · None stated GitHub repository of TQQQ MA+TSI
330 stars

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

Strategy v4 Oscillators & momentumDivergence Repaints
Updated 2 months ago · None stated GitHub repository of MACD + Divergences [Alorse]

Trust Me Bro Strategy

by moonyroy
2 stars

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

Strategy v6 Oscillators & momentumDivergence
Updated 7 weeks ago · MIT GitHub repository of Trust Me Bro Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers