资源加载中... loading...

Reversal Momentum Breakout Strategy

Author: ChaoZhang, Date: 2024-02-23 12:11:32
Tags:

img

Overview

The Reversal Momentum Breakout Strategy is a quantitative trading strategy that generates trading signals using price reversal and momentum indicators. Based on the theory of “momentum leads price”, this strategy tracks the highest and lowest prices over a certain period to determine whether the market is at a key reversal point to capture reversal opportunities.

Strategy Principle

The core logic of this strategy is to identify market reversal points by calculating the highest and lowest prices over a specified lookback window (e.g. 20 days). The specific logic is:

  1. Calculate the highest price (window_high) and lowest price (window_low) over the past 20 days.

  2. If today’s high is higher than the maximum of the past 20 days (a new 20-day high), enter the high reversal monitoring period and set the counter to 5 days.

  3. If no new high occurs, deduct the counter by 1 each day. When the counter reaches 0, the high reversal monitoring period ends.

  4. The judgment logic for the lowest price is similar. If a new low occurs, enter the low reversal monitoring period.

  5. long and short positions are taken within the reversal monitoring periods. Reversal signals near the key reversal points allow capturing larger moves.

The strategy also sets the start trading time to avoid generating signals on historical data.

Advantage Analysis

The Reversal Momentum Breakout Strategy has the following main advantages:

  1. Captures reversal opportunities, suitable for reversal trends. Markets often show some degree of reversal after a sustained uptrend or downtrend. This strategy aims to capture these turning points.

  2. Momentum leads, relatively sensitive. Tracking the highest and lowest prices over a window can sensitively identify price reversal trends and timing.

  3. Reversal monitoring periods avoid false signals. Signals are generated only around key reversal points, filtering out some noise.

  4. Allows long and short positions. Alternates between long and short following market direction.

  5. Relatively simple logic, easy to implement. Mainly relies on price and simple momentum indicators, easy to code.

Risk Analysis

The main risks of this strategy include:

  1. Inaccurate reversal prediction. The strategy can incur losses if the market trends directionally.

  2. Overall market trends not considered. Individual stock reversals do not necessarily represent market reversals. Market analysis should be combined.

  3. Potentially large drawdowns. Drawdown may expand without actual reversals.

  4. Data fitting bias. Performance may significantly differ from backtests.

  5. Parameter sensitivity. Window period, counter parameters etc. affect stability.

Corresponding risk control methods include optimizing stop loss, incorporating market factors, adjusting parameter combinations and verifying stability.

Enhancement Directions

The main optimization directions include:

  1. Incorporate market indicators. Assess market strength to avoid unfavorable big picture environments.

  2. Multi-factor stock selection. Select stocks with sound fundamentals and overvaluation.

  3. Parameter optimization. Adjust window period and counter parameters to find optimal parameter combinations.

  4. Add stop loss strategies e.g trailing stops, volatility stops to control max drawdown.

  5. Increase machine learning predictive accuracy of price reversals.

Conclusion

The Reversal Momentum Breakout Strategy identifies reversal opportunities by tracking price and momentum. It reacts sensitively and identifies reversal trends and timing. But it has risks that require proper optimizations and risk control. Overall, when thoroughly understood and optimized, it can form an effective component of a quantitative trading system.


/*backtest
start: 2023-02-16 00:00:00
end: 2024-02-22 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("New Highs and Lows Momentum Strategy", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)

window = input.int(20, title="New Highs and Lows Window", minval=1)
decay = input.int(5, title="Decay", minval=1)
startDate = input(timestamp("1 Jan 2023"), title = "Start Date")
allowShort = input.bool(false, title = "Allow shorting")

var int highDecayCounter = 0
var bool isHighPeriod = false
var int lowDecayCounter = 0
var bool isLowPeriod = false

inTradeWindow = true

window_high = ta.highest(close, window)
window_low = ta.lowest(low, window)

// Logic for Highs
if window_high > ta.highest(close, window)[1]
    highDecayCounter := decay
    isHighPeriod := true
else
    if highDecayCounter > 0
        highDecayCounter := highDecayCounter - 1
    else
        isHighPeriod := false

// Logic for Lows
if window_low < ta.lowest(low, window)[1]
    lowDecayCounter := decay
    isLowPeriod := true
else
    if lowDecayCounter > 0
        lowDecayCounter := lowDecayCounter - 1
    else
        isLowPeriod := false

// Strategy Execution
if inTradeWindow
    if isHighPeriod and highDecayCounter == decay
        strategy.entry("Long", strategy.long)

    if isHighPeriod and highDecayCounter == 0
        strategy.close("Long")

    if isLowPeriod and lowDecayCounter == decay and allowShort
        strategy.entry("Short", strategy.short)

    if isLowPeriod and lowDecayCounter == 0 and allowShort
        strategy.close("Short")

// Plotting
plot(window_high, color=color.green)
plot(window_low, color=color.red)
template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6