The Momentum Burst Tracking Strategy

Author: ChaoZhang, Date: 2024-03-01 11:08:43



The Momentum Burst Tracking strategy judges price breakthroughs by calculating percentage price changes and filters signals with trading volume to implement high probability capturing of trend breakthrough points. After triggering a buy signal, this strategy uses price tracking stop loss to lock in profits and avoid excessive drawdowns.

Strategy Principle

The main indicators this strategy uses to determine entry signals are:

  1. Percentage price change (isFourPercentBull) - Calculate the percentage change of the closing price relative to the previous day’s closing price to determine if the price has effectively broken through.

  2. Ratio of closing price to highest price (HighCloseRatio) - Calculate the ratio of the closing price to the highest price to determine the strength of the price breakthrough.

  3. Trading volume (volume) - Require the trading volume to be greater than the previous day to ensure valid breakthrough.

  4. 200-day simple moving average (SMA) - Require the closing price and opening price to be higher than the 200-day line to determine the trend direction.

When the above multiple conditions are met at the same time, a buy signal is issued. Afterwards, the strategy uses price tracking stop loss to actively stop loss and lock in profits. Specifically, the calculation formula for the trailing stop loss line is:

trailPrice = close * (100 - trailPercent) / 100

Where trailPercent is the configurable trailing stop loss percentage. This ensures that as long as prices rise, the stop loss line will also rise to lock in profits. When prices fall back to the stop loss line, close positions to stop losses.

Advantages of the Strategy

As a typical breakout strategy, it has the following advantages:

  1. Multi-condition filtering ensures the validity of the breakout and avoids false breakouts.

  2. Adopt price tracking stop loss, which can actively cut losses and lock in profits to maximize avoiding drawdowns.

  3. The strategy logic is simple and clear, easy to understand and optimize.

Risks of the Strategy

The strategy also has some risks:

  1. There is still a probability of failed breakouts that cannot completely avoid losses.

  2. Overly aggressive tracking stops may cause frequent stops.

  3. Improper parameter settings can lead to excessive trading frequencies or missed signals.

The solutions to the corresponding risks are:

  1. Optimize parameters and reduce stop loss magnitude to ensure sufficient room.

  2. Reasonably relax the breakout conditions to ensure clear trends are not missed.

  3. Test different varieties to evaluate strategy stability.

Optimization Directions

Considering the high frequency of stops in this strategy, the following directions can be further optimized:

  1. Try other tracking stop loss methods, such as moving average tracking, ATR and volatility tracking.

  2. Increase machine learning algorithms to train judgments of better performing parameter combinations based on historical data.

  3. Add auxiliary judgment conditions based on volume breakouts to ensure effectiveness.

  4. Evaluate differences in parameter settings across different varieties to find the best fit.


The Momentum Burst Tracking Strategy is a very practical trend tracking strategy overall. It solves the problem of inability to effectively stop loss and profit taking in breakout strategies, while still controlling risks well when capturing trends. With room for further improvement by introducing optimizations and machine learning, it is worth in-depth research and application.

start: 2023-03-01 00:00:00
end: 2023-12-10 05:20:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

// This source code is subject to the terms of the Mozilla Public License 2.0 at
// © doks23

strategy(title = "SD:Momentum Burst", overlay=true, initial_capital=1000,commission_value = 0,slippage = 0,process_orders_on_close=true)

//Check Vol
checkVol = input.bool(defval=false,title="IncludeAvgVolume?")
volSMAlength = input(50, title="VolumeLength")
volumeSma = ta.sma(volume, volSMAlength)
highvolume = volume >= volumeSma

// Profit and Loss
trailPercent    = input.float(title="Trail%", defval=3, step=0.1)

PercentThreshold=input.float(3.8,'BreakoutPercent', step=0.1)
MaxThreshold=input.float(10,'Max Breakout', step=0.1)
HighCloseRatio=input.float(70,'Close to High Ratio', step=1)
float candleCloseBull = ((close[0] - open[0]) / (high[0] - open[0]) * 100)
float isFourPercentBull = (((close[0] - close[1]) / close[1]) * 100)
LongCond=volume > volume[1] and isFourPercentBull > PercentThreshold and candleCloseBull > HighCloseRatio and isFourPercentBull<MaxThreshold
barcolor(color=(LongCond?color.yellow: na),title='BObar')
longCondition= LongCond and volumeCond and close>ta.sma(close,200) and open>ta.sma(close,200)

//Input Strategy
DateCheck=  input.bool(title = 'Custom Date Range?', defval=true,group = 'Strategy')
FromDate=   input(defval = timestamp("1 Jan 2019 00:00"),group = 'Strategy')
ToDate      =input(defval = timestamp("31 Dec 2023 00:00"),group = 'Strategy')
PostionSize =input.string('Contract','Select Position Size',options = ['Percent of Equity','Contract'],group = 'Strategy')
ContractQty,'No of Contract',group = 'Strategy')

//Backtesting Date Range
// Number of Contract
var int trade_qty=na
    trade_qty:= (strategy.equity>strategy.initial_capital)?math.floor(strategy.equity/strategy.initial_capital):ContractQty

//Position Buy
BuyTriggerPrice = ta.valuewhen(longCondition,high,0)
//Trailing price
var float trailPrice    = na
float percentMulti = (100 - trailPercent) / 100
longCondition2=longCondition and TimeWindow
if longCondition2
    strategy.entry("Long", strategy.long,qty=trade_qty,stop = BuyTriggerPrice)
    trailPrice := close*percentMulti
if strategy.position_size>0
    trailPrice := math.max(close*percentMulti,trailPrice[1])
    if low <= trailPrice
        strategy.exit('Exit','Long',stop = trailPrice)
        if strategy.position_size==0     
// Plot Strategy
var float trail_long_SL=na
if strategy.position_size>0
//Strategy Plot
PlotMA=input.bool(title="Plot MA?", defval=false)
plot(PlotMA?ta.sma(close,10):na,color =,title = '10MA')
plot(PlotMA?ta.sma(close,21):na,color = color.white,title = '21MA')
plot(PlotMA?ta.sma(close,200):na,color =,title = '200MA')
// plot(trail_long_SL,color = color.gray,style = plot.style_steplinebr,linewidth = 1)