OPEN-SOURCE SCRIPT

Momentum Sequence Strategy+ [Herman]

15 068
Momentum Sequence Strategy [Herman] is an open-source, rules-based price-action strategy designed to test momentum continuation following a defined candle sequence.

The strategy does not use moving averages, oscillators, volume indicators, or higher-timeframe data. Its signals are derived entirely from the relationship between consecutive OHLC candles.

The objective is to identify situations where an initial candle establishes a protected price extreme and is followed by a sequence of candles showing consistent momentum in the opposite direction.

How the strategy works

The model begins with a Main Candle, followed by a user-defined number of consecutive confirmation candles.

The number of following candles can be set to:

2
3
4
5

The default setting is 5 following candles.

Long setup

A Long setup requires:

The Main Candle to be bearish.
Every following candle to be bullish.
The low of every following candle must remain strictly above the low of the Main Candle.
Each new bullish candle must close higher than the previous bullish candle.
No position may already be open.

In simplified form:

Bearish Main Candle -> Bullish -> Bullish -> ... -> Long

The low of the Main Candle acts as the invalidation level for the sequence.

Short setup

The Short setup is the exact inverse of the Long setup.

A Short setup requires:

The Main Candle to be bullish.
Every following candle to be bearish.
The high of every following candle must remain strictly below the high of the Main Candle.
Each new bearish candle must close lower than the previous bearish candle.
No position may already be open.

In simplified form:

Bullish Main Candle -> Bearish -> Bearish -> ... -> Short

The high of the Main Candle acts as the invalidation level.

Long and Short trading can be enabled or disabled independently.

By default:

Long Trades: ON
Short Trades: OFF

The strategy allows only one open position at a time.

Stop Loss

For Long trades, the Stop Loss is placed at the low of the Main bearish Candle.

For Short trades, the Stop Loss is placed at the high of the Main bullish Candle.

This means the candle that begins the sequence defines the structural invalidation point of the trade.

Take Profit

The strategy uses configurable R-based targets:

0.5R / 1R / 1.5R / 2R

The default setting is 1.5R.

For a Long setup, risk is measured from the closing price of the final confirmation candle to the low of the Main Candle.

For a Short setup, risk is measured from the closing price of the final confirmation candle to the high of the Main Candle.

The selected R multiple is then applied to that distance to calculate the Take Profit level.

Important execution detail


The strategy identifies a completed sequence using confirmed candle data.

Under TradingView's standard historical strategy execution model, a market order generated after a confirmed bar will normally be filled on the next available tick, which is typically the open of the following bar.

The strategy calculates its R-based target using the close of the signal candle, rather than the eventual simulated market fill price.

Because of this, the selected 0.5R, 1R, 1.5R, or 2R setting represents the strategy's target calculation model and may not equal the exact realized risk-to-reward ratio measured from the simulated fill price. Gaps, market movement between bars, commissions, and slippage can further affect actual results.

Visuals

The strategy can display:

Long setup markers
Short setup markers
Active Stop Loss
Active Take Profit
A configurable statistics/settings table

The table displays the currently selected Take Profit, sequence length, and enabled trade directions.

Default configuration


The default script inputs are:

Following Candles: 5
Take Profit: 1.5R
Long Trades: ON
Short Trades: OFF
Entry Signals: ON
Stop Loss / Take Profit display: ON

These defaults are provided as a starting configuration for research and are not presented as optimized parameters for any particular market or timeframe.

Users are encouraged to evaluate different configurations across sufficiently large datasets rather than selecting parameters solely because they produced favorable historical results.

Intended use and limitations

This is a mechanical backtesting strategy intended for studying a specific candle-sequence behavior.

It does not evaluate market regime, trend, volatility, liquidity, volume, news events, session context, support/resistance, or other discretionary information.

A valid sequence therefore does not imply that a profitable trade will follow.

Historical strategy results are hypothetical and do not predict future performance. Results can vary materially depending on symbol, timeframe, trading costs, liquidity, execution assumptions, and selected parameters.

The strategy should be evaluated on standard price-based candlestick charts. Non-standard chart types such as Heikin Ashi, Renko, Range, Kagi, or Point & Figure can produce strategy results that do not correspond to tradable market prices.


This version extends that foundation with:


Pine Script v6 implementation
Configurable 2-5 candle sequence length
Mirrored Short-side logic
Independent Long/Short controls
Configurable R-based profit targets
One-position-at-a-time execution
Stop Loss and Take Profit visualization
Configurable on-chart settings table
Expanded user controls and documentation

The script is published open-source so users can inspect the complete methodology, verify its behavior, modify it, and conduct their own research.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.