Momentum Moving Average Persistent Long Trading Strategy

Author: ChaoZhang, Date: 2023-09-12 16:15:44
Tags:

This strategy trades long during sustained momentum by observing persistent moving average uptrends, aiming to continuously ride the momentum of bull runs. It is a trend-following strategy focused on capturing upside momentum.

Strategy Logic:

  1. Calculate weighted moving average to reflect price momentum.

  2. Enter long when weighted moving average rises persistently for 5 days.

  3. Exit long when weighted moving average falls for 4 consecutive days.

  4. Persistent uptrend days filter out short-term reversals.

  5. Set maximum stop loss to limit maximum daily loss.

Advantages:

  1. Tracking upside momentum allows holding hot trends.

  2. Persistence filter skips short consolidations.

  3. Maximum stop loss defends tail risks.

Risks:

  1. No limit on pullback losses after persistent uptrends.

  2. Deep corrections can bring large losses.

  3. Overly wide stops bring risk of outsized losses.

In summary, this strategy persists in trading the momentum after identifying sustained uptrends, benefiting from hot trends. But deep pullback risks remain, requiring calibrated stops and prudent risk management.


/*backtest
start: 2023-01-01 00:00:00
end: 2023-09-11 00:00:00
period: 3d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SoftKill21

//@version=4
// strategy("My Script", initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent , commission_value=0.1 )


var candela = 0.0


candela := (high+low+open+close)/4

long = candela > candela[1] and candela[1] > candela[2] and candela[2] > candela[3] and candela[3] > candela[4] and candela[4] > candela[5]
short = candela< candela[1] and candela[1] < candela[2] and candela[2] < candela[3] and candela[3] < candela[4] //and candela[4] < candela[5] 

plot(candela, color=long? color.green : short? color.red : color.white ,linewidth=4)



strategy.entry("long",1,when=long)
//strategy.entry('short',0,when=short)
    
strategy.close("long", when = short)

risk= input(25)
// strategy.risk.max_intraday_loss(risk, strategy.percent_of_equity)
//strategy.close("short", when = not long or short)


More