Strategy · Pine Script v5 · On the chart

Strong Trending - Momentum Rider

by Basant1Saini· code credited to TradingTools

Strong Trending - Momentum Rider is a trend-following strategy designed for intraday and swing trading.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code99
Settings14inputs
LicenceNone statedfile: MPL-2.0
Last update7 months ago4 Mar 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  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

99 lines of Pine Script v5 from 5_Strong_Trending/5_Strong_Trending.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

5_Strong_Trending.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0
// © TradingTools

//@version=5
strategy("Strong Trending - Momentum Rider", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// ─── Inputs ───
emaFastLen      = input.int(9, "Fast EMA Length", group="Moving Averages")
emaSlowLen      = input.int(21, "Slow EMA Length", group="Moving Averages")
emaTrendLen     = input.int(50, "Trend EMA Length", group="Moving Averages")
adxLength       = input.int(14, "ADX Length", group="ADX")
adxSmoothing    = input.int(14, "ADX Smoothing", group="ADX")
adxMin          = input.float(25, "Min ADX for Strong Trend", step=1, group="ADX")
adxStrong       = input.float(40, "Strong Trend ADX", step=1, group="ADX")
volMultiplier   = input.float(1.5, "Volume Spike Multiplier", step=0.1, group="Volume")
volLength       = input.int(20, "Volume MA Length", group="Volume")
useVolumeFilter = input.bool(true, "Require Volume Confirmation", group="Volume")
atrLength       = input.int(14, "ATR Length", group="Risk Management")
atrMult         = input.float(1.5, "ATR Multiplier for SL", step=0.1, group="Risk Management")
trailAtrMult    = input.float(2.0, "Trailing Stop ATR Mult", step=0.1, group="Risk Management")
pyramidMax      = input.int(2, "Max Pyramid Entries", minval=1, maxval=5, group="Risk Management")

// ─── Calculations ───
emaFast  = ta.ema(close, emaFastLen)
emaSlow  = ta.ema(close, emaSlowLen)
emaTrend = ta.ema(close, emaTrendLen)
atrVal   = ta.atr(atrLength)

// ─── ADX ───
[diPlus, diMinus, adxVal] = ta.dmi(adxLength, adxSmoothing)
strongTrend   = adxVal >= adxMin
veryStrong    = adxVal >= adxStrong

// ─── Volume Confirmation ───
volMA       = ta.sma(volume, volLength)
volSpike    = volume >= volMA * volMultiplier
volOK       = useVolumeFilter ? volSpike : true

// ─── Momentum Score ───
// Composite score: trend alignment + ADX + volume + candle strength
bullCandle = close > open and (close - open) > (high - low) * 0.6
bearCandle = close < open and (open - close) > (high - low) * 0.6

momentumBull = (emaFast > emaSlow ? 1 : 0) + (close > emaTrend ? 1 : 0) + (strongTrend and diPlus > diMinus ? 1 : 0) + (volOK ? 1 : 0) + (bullCandle ? 1 : 0)
momentumBear = (emaFast < emaSlow ? 1 : 0) + (close < emaTrend ? 1 : 0) + (strongTrend and diMinus > diPlus ? 1 : 0) + (volOK ? 1 : 0) + (bearCandle ? 1 : 0)

// ─── Entry Conditions ───
// Require at least 4/5 momentum score + EMA crossover for initial entry
longEntry    = ta.crossover(emaFast, emaSlow) and momentumBull >= 4 and close > emaTrend
shortEntry   = ta.crossunder(emaFast, emaSlow) and momentumBear >= 4 and close < emaTrend

// Pyramid: add to position if trend gets even stronger
pyramidLong  = strategy.position_size > 0 and veryStrong and diPlus > diMinus and volOK and momentumBull >= 4
pyramidShort = strategy.position_size < 0 and veryStrong and diMinus > diPlus and volOK and momentumBear >= 4

// ─── Execute Trades ───
if longEntry and strategy.position_size <= 0
    sl = close - atrVal * atrMult
    strategy.entry("Trend Long", strategy.long)
    strategy.exit("Trend Long Exit", "Trend Long", stop=sl, trail_offset=atrVal * trailAtrMult, trail_points=atrVal * trailAtrMult)

if shortEntry and strategy.position_size >= 0
    sl = close + atrVal * atrMult
    strategy.entry("Trend Short", strategy.short)
    strategy.exit("Trend Short Exit", "Trend Short", stop=sl, trail_offset=atrVal * trailAtrMult, trail_points=atrVal * trailAtrMult)

// Pyramid entries
if pyramidLong and strategy.opentrades < pyramidMax
    strategy.entry("Trend Long Add", strategy.long)

if pyramidShort and strategy.opentrades < pyramidMax
    strategy.entry("Trend Short Add", strategy.short)

// ─── Exit on Trend Exhaustion ───
if strategy.position_size > 0 and (ta.crossunder(emaFast, emaSlow) or adxVal < adxMin)
    strategy.close_all(comment="Trend Exhausted")
if strategy.position_size < 0 and (ta.crossover(emaFast, emaSlow) or adxVal < adxMin)
    strategy.close_all(comment="Trend Exhausted")

// ─── Plotting ───
plot(emaFast, "Fast EMA", color=color.new(color.teal, 0), linewidth=2)
plot(emaSlow, "Slow EMA", color=color.new(color.orange, 0), linewidth=2)
plot(emaTrend, "Trend EMA", color=color.new(color.white, 30), linewidth=3)

// ADX-based trend strength background
bgColor = veryStrong ? (diPlus > diMinus ? color.new(color.green, 85) : color.new(color.red, 85)) : strongTrend ? (diPlus > diMinus ? color.new(color.green, 93) : color.new(color.red, 93)) : na
bgcolor(bgColor, title="Trend Strength")

// Momentum score label
plotshape(longEntry, title="Long Entry", location=location.belowbar, style=shape.triangleup, color=color.lime, size=size.normal, text="STRONG")
plotshape(shortEntry, title="Short Entry", location=location.abovebar, style=shape.triangledown, color=color.fuchsia, size=size.normal, text="STRONG")

// Volume spike markers
plotshape(volSpike and strongTrend, title="Vol Spike", location=location.bottom, style=shape.circle, color=color.new(color.yellow, 30), size=size.tiny)

// ─── Alerts ───
alertcondition(longEntry, title="Strong Trend Long", message="Strong Trending: Bullish momentum confirmed — Long entry")
alertcondition(shortEntry, title="Strong Trend Short", message="Strong Trending: Bearish momentum confirmed — Short entry")
alertcondition(veryStrong and volSpike, title="Very Strong Trend + Volume", message="Strong Trending: Very strong trend with volume spike detected")

Overview

Strong Trending - Momentum Rider evaluates market strength using a composite momentum score based on exponential moving averages, the Directional Movement Index (DMI/ADX), candle body ratio, and volume spikes. Long and short trades trigger when fast and slow EMAs cross in alignment with a 50-period trend filter and a composite score threshold. Trades are managed with ATR-based initial stop losses and trailing stops, with optional pyramiding during very strong trend conditions.

Details

Published by

Basant1Saini on GitHub

Code credit

TradingTools, as written in the script's header

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Trend, Oscillators & momentum, Moving averages, Volatility & bands

Markets

Stocks, Forex, Crypto

Timeframes

M15-H1, H4 and above

Risk Notes

  • The strategy can add several entries in the same direction

Settings

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

SettingTypeDefaultVariable
Fast EMA Lengthint9emaFastLen
Slow EMA Lengthint21emaSlowLen
Trend EMA Lengthint50emaTrendLen
ADX Lengthint14adxLength
ADX Smoothingint14adxSmoothing
Min ADX for Strong Trendfloat25adxMin
Strong Trend ADXfloat40adxStrong
Volume Spike Multiplierfloat1.5volMultiplier
Volume MA Lengthint20volLength
Require Volume ConfirmationbooltrueuseVolumeFilter
ATR Lengthint14atrLength
ATR Multiplier for SLfloat1.5atrMult
Show all 14 settings
SettingTypeDefaultVariable
Trailing Stop ATR Multfloat2.0trailAtrMult
Max Pyramid Entriesint2pyramidMax
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

106 stars

This trading strategy combines three Exponential Moving Averages (8, 14, and 50 periods by default) with Stochastic RSI and Average True Range (ATR). It enters a long position when EMA 1 is above EMA 2, EMA 2 is above EMA 3, and the Stochastic RSI %K line cros

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of 3 x EMA + Stochastic RSI + ATR

Momentum Rider DAILY FINAL

by greenpeas007
58 stars

This strategy combines exponential moving averages (EMA 9, 21, 50), RSI, MACD, and Supertrend indicators to enter long positions. It triggers trades using six dynamic setups based on momentum breakouts, EMA crossovers, and pullbacks. Position sizing is compute

Strategy v6 TrendOscillators & momentum Repaints
Updated 4 months ago · Custom licence GitHub repository of Momentum Rider DAILY FINAL

CombinedBinHAndClucV6

by viktors1982
36 stars

CombinedBinHAndClucV6 is a trading strategy based on the popular BinHV45 and ClucMay72018 algorithms. It calculates dual Bollinger Bands, Exponential Moving Averages, Relative Strength Index, Average True Range, and volume metrics across primary and one-hour h

Strategy v4 Volatility & bandsOscillators & momentum Repaints
Updated 2 years ago · None stated GitHub repository of CombinedBinHAndClucV6

BB Swing

by benso87
24 stars

This strategy calculates Bollinger Bands, a configurable moving average slope, Stochastic RSI, ATR, and ADX directly on the price chart. It evaluates trend bias and momentum conditions to generate long and short swing entries using percent-of-equity sizing. Th

Strategy v5 Volatility & bandsOscillators & momentum
Updated 4 years ago · MPL-2.0 GitHub repository of BB Swing

This strategy trades long and short on the price chart using a multi-timeframe TradingLatino setup. It requires EMA 10 to cross or sit above or below EMA 55 on the one-hour, four-hour, and daily charts, together with a positive ADX slope, a directional monitor

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard ABCBitcoin TradingLatino A010

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