This article introduces a breakout strategy based on dynamic channels formed by Keltner channels or Bollinger bands. It determines trend direction using the channels and trades breakouts.
## Strategy Logic
The main logic is:
1. Use dynamic channels to determine trends. Break above suggests uptrend, and below suggests downtrend.
2. Choose wick or close breakouts as entry signals.
3. Set separate long and short take profit and stop loss, such as previous wick, extended channel, or ATR.
4. Add filters like trading hours and ATR to control frequency.
5. Consider counter-trend entries to profit from market momentum.
## Advantage Analysis
Advantages of the strategy:
1. Dynamic channels make trend determination straightforward.
2. Breakout logic and stop settings are clear.
3. Custom filters help control risk.
4. Counter-trend trades capitalize on momentum.
5. Simple logic makes testing and optimization intuitive.
## Risk Analysis
Main risks include:
1. Channels may fail during volatile markets.
2. Fakeouts can cause bad trades. Assess breakout validity.
3. Bad stop loss settings could limit profits.
4. High frequency may increase costs and risk.
5. Additional risk from counter-trend trades needs control.
## Conclusion
This strategy combines channel trend analysis with breakout trading. With risk control, optimization can achieve good returns. But traders should watch out for bad signals and adjust accordingly.
[/trans]
> Strategy Arguments
|Argument|Default|Description|
|----|----|----|
|v_input_float_1|true|(?Time_Delay)Delay between orders:|
P_cond_entrada = input.string("Wick out of band", "Enter Condition", ["Wick out of band", "Wick out of the band then close in", "Out-of-band closure", "Close out of the band then close in"], "Se puede escoger (en orden) que el precio haya salido de la banda, que además la siguiente vela cierre de nuevo dentro de la misma, que el precio tenga que cerrar fuera, y que además la siguiente vela tenga que cerrar dentro de nuevo.", group=GRUPO_P)
TPSL_SL_ATR_mult = input.float(title="• (Solo ATR) Multiplicador Stop Loss", group=GRUPO_TPSL, defval=1, minval=0.1, step=0.1, inline="tp_sl", tooltip="These are the ATR multipliers to calculate STOP LOSS and TAKE PROFIT if selected as such.")
TPSL_SL_BB_dev = input.float(title="• (Solo STOP LOSS con BB) Desviación estándar", group=GRUPO_TPSL, defval=4.0, minval=0.01, step=0.5, tooltip="In case of using Bollinger Bands as STOP LOSS, this will be the value of its standard deviation.")
TPSL_SL_KC_mult = input.float(title="• (Solo STOP LOSS con KC) Multiplicador", group=GRUPO_TPSL, defval=3, minval=0.01, step=0.5, tooltip="In case of using Keltner channels as STOP LOSS, this will be the value of your ATR multiplier.")
TP_SL_TP_dinamico = input.bool(title="Take Profit dinámico", group=GRUPO_TPSL, defval=false, tooltip="This will make the Take Profit adjust bar by bar instead of staying fixed at its initial value.")
ATR_referencia = input.source(title="ATR Reference", group=GRUPO_ATR, defval=close, inline="atr_calc") // The font is not applied to the ATR calculation, it is for the positioning with respect to the price on the chart
// Assign common variables based on the selected indicator
banda_superior = BB_upper
media_movil = BB_mid
banda_inferior = BB_lower
banda_extendida_sup_SL = BB_upper_SL
banda_extendida_inf_SL = BB_lower_SL
if (P_indicador == "Keltner Channel")
banda_superior := KC_upper
media_movil := KC_mid
banda_inferior := KC_lower
banda_extendida_sup_SL := KC_upper_SL
banda_extendida_inf_SL := KC_lower_SL
// Calcular condiciones de entrada
longCondition1 = false
shortCondition1 = false
if (P_cond_entrada == "Wick out of band")
longCondition1 := low < banda_inferior
shortCondition1 := high > banda_superior
else if (P_cond_entrada == "Wick out of the band then close in")
longCondition1 := low[1] < banda_inferior and close > banda_inferior
shortCondition1 := high[1] > banda_superior and close < banda_superior
else if (P_cond_entrada == "Out-of-band closure")
longCondition1 := close < banda_inferior
shortCondition1 := close > banda_superior
else // Close out of the band then close in
longCondition1 := close[1] < banda_inferior and close > banda_inferior
shortCondition1 := close[1] > banda_superior and close < banda_superior
//== Entrada (deben cumplirse todas para entrar)
longCondition2 = true
longCondition3 = true
long_conditions = longCondition1 and longCondition2 and longCondition3
entrar_en_LONG = P_permitir_LONGS and long_conditions and vela_en_fecha and ATR > 0.0 // Lo del ATR > 0.0 es por seguridad ya que puede darse una entrada donde aún no es calculable el ATR porque no existan velas y nunca cerrar posición pues no se creó correctamente // Solo permitir 1 posición al mismo tiempo
shortCondition2 = true
shortCondition3 = true
short_conditions = shortCondition1 and shortCondition2 and shortCondition3
entrar_en_SHORT = P_permitir_SHORTS and short_conditions and vela_en_fecha and ATR > 0.0 // Lo del ATR > 0.0 es por seguridad ya que puede darse una entrada donde aún no es calculable el ATR porque no existan velas y nunca cerrar posición pues no se creó correctamente // Solo permitir 1 posición al mismo tiempo
var LONG_take_profit = 0.0
var LONG_stop_loss = 0.0
var SHORT_take_profit = 0.0
var SHORT_stop_loss = 0.0
if (entrar_en_LONG and not posicion_abierta and delayElapsed and ATRfilterOk)