El autor:¿ Qué pasa?
Las etiquetas:

img

Resumen general

Estrategia lógica

Ventajas

  1. Los dos filtros del canal SMA y ATR aseguran señales comerciales más confiables, reduciendo las señales falsas.

  2. Incluye operaciones largas y cortas para beneficiarse de las tendencias ascendentes y descendentes.

Análisis de riesgos

  1. El SMA tiene un riesgo sistémico de retraso en los giros del mercado.

Soluciones posibles:

Oportunidades de mejora

  1. Cortar pérdidas rápidamente cuando el precio se aleja de la línea de base SMA.

Resumen de las actividades


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

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © omererkan

//@version=5
strategy(title="ATR Channel Breakout")

smaLength = input.int(150, title="SMA Length")
atrLength = input.int(30, title="ATR Length")

ubOffset = input.float(4, title="Upperband Offset", step=0.50)
lbOffset = input.float(4, title="Lowerband Offset", step=0.50)


smaValue = ta.sma(close, smaLength)
atrValue = ta.atr(atrLength)

upperBand = smaValue + (ubOffset * atrValue)
lowerBand = smaValue - (lbOffset * atrValue)


plot(smaValue, title="SMA", color=color.orange)
plot(upperBand, title="UB", color=color.green, linewidth=2)
plot(lowerBand, title="LB", color=color.red, linewidth=2)


enterLong = ta.crossover(close, upperBand)
exitLong  = ta.crossunder(close, smaValue)


enterShort = ta.crossunder(close, lowerBand)
exitShort  = ta.crossover(close, smaValue)


if enterLong
    strategy.entry("Long", strategy.long)

if enterShort
    strategy.entry("Short", strategy.short)


if exitLong
    strategy.close("Long", "Close Long")

if exitShort
    strategy.close("Short", "Close Short")

Más.