Amazing Price Breakout Strategy

Author: ChaoZhang, Date: 2024-01-30 15:07:08
Tags:

img

Overview: This strategy utilizes Bollinger Bands, KDJ indicator and trend following for price breakout operations. It can make long and short entries at breakout points and set stop loss to control risks.

Strategy Logic:

  1. Calculate 15-day and 30-day simple moving averages to determine the price trend.

  2. Calculate Bollinger Bands upper and lower rail, and combine candlestick breakout of BB rails to determine entries and exits.

  3. Use RSI indicator to judge overbought and oversold conditions. RSI greater than 50 indicates overbought signal and RSI less than 50 indicates oversold signal.

  4. When price breaks above the BB upper rail with RSI greater than 50, a buy signal is generated. When price breaks below the BB lower rail with RSI less than 50, a sell signal is generated.

  5. Set ATR stop loss to control risks.

Advantages:

  1. The strategy combines multiple indicators like Bollinger Bands and RSI to determine trading signals, which can effectively avoid errors caused by single indicator.

  2. With trend filtering, it prevents wrong signals during consolidation and reversal.

  3. ATR stop loss controls risks for each trade.

  4. The strategy logic is simple and easy to understand.

Risks & Improvements:

  1. As an envelope indicator, the BB upper and lower rails are not absolute support/resistance levels. Prices may break the rails and hit stop loss. Can set wider stop loss or use other stop loss methods like time exit.

  2. RSI may fail in some markets. Can consider combining other indicators like KDJ and MACD for more reliable overbought/oversold judgement.

  3. Wrong signals may occur during reversals and consolidations. Can add trend filter to only trade along the major trend.

Enhancement Suggestions:

  1. Test and optimize BB period and standard deviation for different products.

  2. Test and optimize RSI period parameter.

  3. Test other stop loss methods like trailing stop loss and time exit.

  4. Add more trend indicators and signal indicators to build multifactor models.

Conclusion:

The strategy combines BB, RSI and other indicators for entry and exit signals. It controls risks while ensuring signal accuracy. More optimization can be done on parameters and enhancements like multifactor models. Overall it provides a simple and practical idea on price breakout strategies.


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("Custom Strategy", overlay=true)

length = 14
mult = 0.75
atr = atr(length) * mult

// Moving averages
ma15 = sma(close, 15)
ma30 = sma(close, 30)

// Bullish Engulfing pattern
bullishEngulfing = close[1] < open[1] and close > open and close[1] < open and close > open[1]

// Bearish Engulfing pattern
bearishEngulfing = close[1] > open[1] and close < open and close[1] > open and close < open[1]

// RSI
rsi = rsi(close, length)

// Buy condition
if (bullishEngulfing and close[1] > ma15 and rsi > 50)
    strategy.entry("Buy", strategy.long)
    strategy.exit("Sell", "Buy", stop=close - atr)

// Sell condition
if (bearishEngulfing and close[1] < ma15 and rsi < 50)
    strategy.entry("Sell", strategy.short)
    strategy.exit("Cover", "Sell", stop=close + atr)

// Plotting
plotshape(series=strategy.position_size > 0, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, text="Buy")
plotshape(series=strategy.position_size < 0, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell")


More