Willy Wonka Breakout Strategy

Author: ChaoZhang, Date: 2024-02-05 10:00:35



The Willy Wonka Breakout Strategy is a breakout trading strategy that integrates multiple technical indicators analysis, mainly utilizing RSI, Stochastics, EMA and price patterns to identify buying and selling opportunities.

Strategy Logic

The strategy makes judgments mainly based on the following key indicators:

  1. RSI Indicator - A buying signal is generated when the RSI breaks below 28, and a selling signal is generated when the RSI breaks above 72.
  2. Stochastics Indicator - A buying signal is generated when the fast K line breaks up from below the slow D line.
  3. EMA Indicator - A buying signal is generated when the price breaks above the EMA in an uptrend, and a selling signal is generated when the price breaks below the EMA in a downtrend.
  4. Price Patterns - Buying and selling signals are generated when hammer and engulfing patterns are formed at key support or resistance levels.

When multiple conditions are triggered at the same time, more effective buying or selling signals will occur.

The strategy adopts the Breakout concept to trade breakouts at trend reversal points, aiming to capture the acceleration stage of the intermediate trend and achieve excess returns.


The strategy integrates multiple analytical tools for a more comprehensive and accurate judgment of market conditions. The main advantages are:

  1. Higher win rate and risk-reward ratio - Improved accuracy by combining multiple technical indicators analysis.
  2. Automatically avoid ranging markets - Indicators like RSI identify overbought and oversold conditions to reduce non-trend trading risks.
  3. Effective risk control - Timely stop loss and take profit help avoid risks like being trapped.


There are also some risks to this strategy that need to be guarded against:

  1. Parameters optimization risk - RSI parameters, MA parameters, etc. need to be optimized for different products and time periods, otherwise profits will be affected.
  2. Chasing momentum risk - Breakout signals have a certain lag. Avoid chasing momentum near the end of trends.
  3. Stop loss risk - Timely stop loss is critical, otherwise losses could be amplified.

The countermeasures are to rationally optimize parameters, strictly follow stop loss rules, and re-establish new positions after price breaks through EMA again.

Optimization Directions

The main aspects of optimization for this strategy:

  1. Optimize RSI Parameters - Find the optimal RSI length parameters and overbought/oversold threshold values for different products.
  2. Integrate More Indicators - Further improve judgment accuracy by combining indicators like MACD, SAR, Bollinger Bands.
  3. Dynamic Stop Loss and Take Profit - Utilize ATR and amplitude ratio for dynamic stops.
  4. Avoid Major Event Risks - Avoid trading around major economic data and events to reduce risks from market volatility.


In summary, the Willy Wonka Breakout Strategy is an integrated mean-reversion breakout trading strategy. It is suitable for products with obvious trend characteristics and generates trading signals at key points to capture intermediate trends. The strategy has great scalability and high practical value.

start: 2024-01-05 00:00:00
end: 2024-02-04 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

strategy("Mi Estrategia", overlay=true)

// Parámetros
rsiLength = input(14, title="RSI Length")
overboughtLevel = 72
oversoldLevel = 28
showRsi = input(true, title="Mostrar RSI en el gráfico")

// Indicadores
rsiValue = ta.rsi(close, rsiLength)

// Condiciones de Compra y Venta
longCondition = rsiValue <= oversoldLevel
shortCondition = rsiValue >= overboughtLevel

// Ejecutar Operaciones
if (longCondition)
    strategy.entry("Compra", strategy.long)

if (shortCondition)
    strategy.entry("Venta", strategy.short)

// Configuración de la Estrategia
// Eliminamos las líneas relacionadas con Take Profit y Stop Loss

// Líneas en el Gráfico (Opcional)
plot(showRsi ? rsiValue : na, "RSI", color=color.blue, linewidth=2)

// Etiquetas de Buy y Sell en el RSI
plotshape(longCondition, color=color.green, style=shape.triangleup, title="Buy en RSI", location=location.belowbar)
plotshape(shortCondition, color=color.red, style=shape.triangledown, title="Sell en RSI", location=location.abovebar)