
Esta estrategia es un sistema de negociación integral que combina múltiples indicadores técnicos. Utiliza principalmente la media móvil (MA), el índice de fuerza relativa (RSI) y el índice direccional promedio (ADX) para identificar las tendencias y el impulso del mercado. El rango verdadero avanzado (ATR) El indicador se utiliza para establecer dinámicamente posiciones de stop loss y take profit. El sistema adopta un método de análisis de múltiples períodos para confirmar las señales comerciales a través del cruce de indicadores en diferentes períodos de tiempo, lo que no solo garantiza la precisión de las transacciones sino que también controla eficazmente los riesgos.
La estrategia utiliza un mecanismo de verificación de tres capas para confirmar las señales comerciales:
Al mismo tiempo, la estrategia utiliza un sistema dinámico de stop loss y take profit basado en ATR:
Esta estrategia construye un sistema de trading relativamente completo a través de la sinergia de múltiples indicadores técnicos. La principal ventaja de la estrategia reside en su mecanismo de verificación de múltiples capas y su sistema dinámico de gestión de riesgos, pero también debe prestarse atención a su adaptabilidad en diferentes entornos de mercado. Se espera que mediante la optimización y mejora continuas, esta estrategia logre rendimientos estables en las transacciones reales.
/*backtest
start: 2024-12-17 00:00:00
end: 2025-01-15 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=6
strategy("Daily Trading Strategy", overlay=true)
// --- Indikator ---
// Kombinasi MA untuk trend
fastMA = ta.sma(close, 20)
slowMA = ta.sma(close, 50)
// RSI untuk momentum
rsi = ta.rsi(close, 14)
// --- Fungsi untuk menghitung ADX ---
adx(length) =>
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, length)
plus = fixnan(100 * ta.rma(plusDM, length) / trur)
minus = fixnan(100 * ta.rma(minusDM, length) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), length)
// ADX untuk kekuatan trend
adxValue = adx(14)
// --- Kondisi Entry Long ---
longEntry = ta.crossover(fastMA, slowMA) and rsi > 50 and adxValue > 25
// --- Kondisi Entry Short ---
shortEntry = ta.crossunder(fastMA, slowMA) and rsi < 50 and adxValue > 25
// --- Stop Loss dan Take Profit ---
// Fungsi untuk menghitung stop loss dan take profit
getSLTP(entryPrice, isLong) =>
atr = ta.atr(14)
sl = isLong ? entryPrice - atr * 2 : entryPrice + atr * 2
tp = isLong ? entryPrice + atr * 4 : entryPrice - atr * 4
[sl, tp]
// Hitung SL dan TP untuk posisi Long
[longSL, longTP] = getSLTP(close, true)
// Hitung SL dan TP untuk posisi Short
[shortSL, shortTP] = getSLTP(close, false)
// --- Eksekusi Order ---
if (longEntry)
strategy.entry("Long", strategy.long, stop=longSL, limit=longTP)
if (shortEntry)
strategy.entry("Short", strategy.short, stop=shortSL, limit=shortTP)
// --- Plot Indikator ---
// MA
plot(fastMA, color=color.blue)
plot(slowMA, color=color.red)
// RSI
plot(rsi, color=color.orange)
hline(50, color=color.gray)
// ADX
plot(adxValue, color=color.purple)
hline(25, color=color.gray)
// --- Alert ---
alertcondition(longEntry, title="Long Entry", message="Long Entry")
alertcondition(shortEntry, title="Short Entry", message="Short Entry")