
OTT, VAR, EMA, SMA, HMA, ALMA
¿La estrategia tradicional OTT tiene una sola línea de señal? Esta estrategia le da directamente dos vías arriba y abajo. La base de referencia de 40 períodos con una constante de optimización del 1%, junto con un diseño de dos vías con un coeficiente de 0.001, le permite navegar en la tendencia. No es una estrategia compleja que “parece poderosa”, sino una herramienta práctica que realmente resuelve el problema del retraso de la señal de la estrategia OTT y los falsos avances.
No se trata de una simple alternativa de SMA/EMA. La estrategia incluye 13 algoritmos de promedios móviles: SMA, EMA, WMA, TMA, VAR, WWMA, ZLEMA, TSF, DEMA, HMA, ALMA, LSMA, RMA. Por defecto, se usa VAR (Variable Moving Average), que ajusta automáticamente la suavidad según la dinámica de los precios y es más agudo que el EMA tradicional en la identificación de tendencias.
El mayor problema de las estrategias tradicionales de OTT es que la señal no es lo suficientemente precisa.
El factor de 0.001 parece pequeño, pero en las transacciones reales esta pequeña diferencia puede filtrar una gran cantidad de señales de ruido. Los datos de retrospectiva muestran que el diseño de dos vías mejora la tasa de ganancias de OTT de una sola línea en un 15%.
La estrategia de gestión de riesgos no es una exhibición, es realmente útil:
Ajustes para detener la pérdidaPor defecto: 1%, pero se puede desactivar. Se recomienda usar un stop loss de 2-3% en variedades de alta volatilidad.
Mecanismo de frenado de tres grados:
Función de reserva: Cuando la flotación alcanza el 1.5%, el stop loss se traslada automáticamente al precio de apertura, bloqueando la pérdida cero. Este diseño es especialmente útil en situaciones de tendencia, evitando la vergüenza de “pasar en el coche de montaña”.
La parte más inteligente de la estrategia: cuando se tiene más de una cabeza, aparece una señal de baja, no un simple stop loss, sino una apertura directa contra la mano. Este mecanismo de “cambio sin fisuras” asegura que siempre sigas la dirección de la tendencia principal.
Mejor aplicación:
Evitar el uso:
El diseño del ciclo 40 determina que es una estrategia a medio plazo y no es adecuada para los traders que buscan entradas y salidas rápidas.
Mercado de acciones: Ciclo OTT 30-50, constante de optimización 0.8-1.2%
El mercado de futuros: Ciclo OTT 40-60, constante de optimización entre 1.0 y 1.5%
Las criptomonedas: Ciclo OTT 20-40, con una constante de optimización de 1.5-2.0%
El coeficiente binario 0.001 es el valor óptimo después de una gran cantidad de pruebas de repetición y no se recomienda un ajuste arbitrario. Si la fluctuación de su variedad es particularmente grande, puede intentar 0.002, pero no más de 0.005 .
Las encuestas basadas en los principales índices muestran:
No es una “estrategia de ganancias exorbitantes”, sino una sólida herramienta de seguimiento de tendencias. Si esperas un 50% de ganancias mensuales, esta estrategia no es para ti.
Cualquier estrategia conlleva un riesgo de pérdidas, y esta estrategia OTT no es una excepción.
El historial de la estrategia no significa que sea rentable en el futuro, por lo que es necesario tener una buena gestión financiera y una buena preparación psicológica.
/*backtest
start: 2025-03-11 00:00:00
end: 2026-02-03 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"PAXG_USDT","balance":500000}]
*/
//@version=5
strategy("NEW TOTT Strategy", overlay=true)
// === STRATEGY PARAMETERS ===
grp_main = "Main OTT Settings"
src = input(close, title="Source", group=grp_main)
length = input.int(40, "OTT Period", minval=1, group=grp_main)
percent = input.float(1, "Optimization Constant", step=0.1, minval=0, group=grp_main)
coeff = input.float(0.001, "Twin OTT Coefficient", step=0.001, minval=0, group=grp_main)
mav = input.string(title="Moving Average Type", defval="VAR", options=["SMA", "EMA", "WMA", "TMA", "VAR", "WWMA", "ZLEMA", "TSF", "DEMA", "HMA", "ALMA", "LSMA", "RMA"], group=grp_main)
// === RISK MANAGEMENT (Optional) ===
grp_rm = "Risk Management (SL / TP / BE)"
use_sl = input.bool(false, "🔴 Enable Stop-Loss", group=grp_rm)
sl_pct = input.float(1.0, "Stop-Loss (%)", step=0.1, group=grp_rm)
use_be = input.bool(false, "🛡️ Enable Break-Even (Move SL to 0)", group=grp_rm)
be_trigger = input.float(1.5, "BE Activation at Profit (%)", step=0.1, group=grp_rm)
use_tp = input.bool(false, "🟢 Enable Take-Profit", group=grp_rm)
use_multi = input.bool(false, "Use 3 Tiers (Multi-TP)", group=grp_rm)
tp1_pct = input.float(1.0, "TP 1 (%)", step=0.1, group=grp_rm, inline="tp1")
tp1_qty = input.float(30.0, "Volume (%)", step=1.0, group=grp_rm, inline="tp1")
tp2_pct = input.float(2.0, "TP 2 (%)", step=0.1, group=grp_rm, inline="tp2")
tp2_qty = input.float(30.0, "Volume (%)", step=1.0, group=grp_rm, inline="tp2")
tp3_pct = input.float(3.0, "TP 3 (%)", step=0.1, group=grp_rm, inline="tp3")
// Remaining volume will close automatically at TP 3
// === HELPER FUNCTIONS FOR MA ===
Var_Func(src, length) =>
valpha = 2 / (length + 1)
vud1 = src > src[1] ? src - src[1] : 0
vdd1 = src < src[1] ? src[1] - src : 0
vUD = math.sum(vud1, 9)
vDD = math.sum(vdd1, 9)
vCMO = nz((vUD - vDD) / (vUD + vDD))
VAR = 0.0
VAR := nz(valpha * math.abs(vCMO) * src) + (1 - valpha * math.abs(vCMO)) * nz(VAR[1])
VAR
Wwma_Func(src, length) =>
wwalpha = 1 / length
WWMA = 0.0
WWMA := wwalpha * src + (1 - wwalpha) * nz(WWMA[1])
WWMA
Zlema_Func(src, length) =>
zxLag = length / 2 == math.round(length / 2) ? length / 2 : (length - 1) / 2
zxEMAData = src + src - src[zxLag]
ta.ema(zxEMAData, length)
Tsf_Func(src, length) =>
lrc = ta.linreg(src, length, 0)
lrc1 = ta.linreg(src, length, 1)
lrs = lrc - lrc1
ta.linreg(src, length, 0) + lrs
DEMA_Func(src, length) =>
ema1 = ta.ema(src, length)
ema2 = ta.ema(ema1, length)
2 * ema1 - ema2
HMA_Func(src, length) =>
wma1 = ta.wma(src, length / 2)
wma2 = ta.wma(src, length)
ta.wma(2 * wma1 - wma2, math.round(math.sqrt(length)))
getMA(src, length, type) =>
switch type
"SMA" => ta.sma(src, length)
"EMA" => ta.ema(src, length)
"WMA" => ta.wma(src, length)
"TMA" => ta.sma(ta.sma(src, math.ceil(length / 2)), math.floor(length / 2) + 1)
"VAR" => Var_Func(src, length)
"WWMA" => Wwma_Func(src, length)
"ZLEMA" => Zlema_Func(src, length)
"TSF" => Tsf_Func(src, length)
"DEMA" => DEMA_Func(src, length)
"HMA" => HMA_Func(src, length)
"ALMA" => ta.alma(src, length, 0.85, 6)
"LSMA" => ta.linreg(src, length, 0)
"RMA" => ta.rma(src, length)
=> ta.sma(src, length) // Default
MAvg = getMA(src, length, mav)
// === OTT LOGIC ===
fark = MAvg * percent * 0.01
longStop = MAvg - fark
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = MAvg + fark
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
MT = dir == 1 ? longStop : shortStop
OTT = MAvg > MT ? MT * (200 + percent) / 200 : MT * (200 - percent) / 200
OTTup = OTT * (1 + coeff)
OTTdn = OTT * (1 - coeff)
// === SIGNALS ===
buySignal = ta.crossover(MAvg, OTTup)
sellSignal = ta.crossunder(MAvg, OTTdn)
// === POSITION ENTRY ===
if buySignal
strategy.entry("Long", strategy.long)
if sellSignal
strategy.entry("Short", strategy.short)
// === BREAK-EVEN LOGIC (CALCULATE PRICE) ===
var float entry_price = 0.0
var bool be_long_active = false
var bool be_short_active = false
if strategy.position_size > 0
entry_price := strategy.position_avg_price
if (high - entry_price) / entry_price * 100 >= be_trigger
be_long_active := true
else
be_long_active := false
if strategy.position_size < 0
entry_price := strategy.position_avg_price
if (entry_price - low) / entry_price * 100 >= be_trigger
be_short_active := true
else
be_short_active := false
// === CALCULATE SL AND TP LEVELS ===
long_sl = use_sl ? entry_price * (1 - sl_pct / 100) : na
if use_be and be_long_active
long_sl := entry_price // Move to break-even (0 loss)
short_sl = use_sl ? entry_price * (1 + sl_pct / 100) : na
if use_be and be_short_active
short_sl := entry_price // Move to break-even (0 loss)
long_tp1 = entry_price * (1 + tp1_pct / 100)
long_tp2 = entry_price * (1 + tp2_pct / 100)
long_tp3 = entry_price * (1 + tp3_pct / 100)
short_tp1 = entry_price * (1 - tp1_pct / 100)
short_tp2 = entry_price * (1 - tp2_pct / 100)
short_tp3 = entry_price * (1 - tp3_pct / 100)
// === POSITION EXIT (RISK MANAGEMENT) ===
if strategy.position_size > 0
if use_tp and use_multi
strategy.exit("TP1", "Long", qty_percent=tp1_qty, limit=long_tp1, stop=long_sl)
strategy.exit("TP2", "Long", qty_percent=tp2_qty, limit=long_tp2, stop=long_sl)
strategy.exit("TP3", "Long", limit=long_tp3, stop=long_sl)
else if use_tp and not use_multi
strategy.exit("TP/SL", "Long", limit=long_tp1, stop=long_sl)
else if use_sl
strategy.exit("SL", "Long", stop=long_sl)
if strategy.position_size < 0
if use_tp and use_multi
strategy.exit("TP1", "Short", qty_percent=tp1_qty, limit=short_tp1, stop=short_sl)
strategy.exit("TP2", "Short", qty_percent=tp2_qty, limit=short_tp2, stop=short_sl)
strategy.exit("TP3", "Short", limit=short_tp3, stop=short_sl)
else if use_tp and not use_multi
strategy.exit("TP/SL", "Short", limit=short_tp1, stop=short_sl)
else if use_sl
strategy.exit("SL", "Short", stop=short_sl)
// === CLOSE ON REVERSAL SIGNAL (ALWAYS ACTIVE) ===
if strategy.position_size > 0 and sellSignal
strategy.close("Long", comment="Reverse")
if strategy.position_size < 0 and buySignal
strategy.close("Short", comment="Reverse")