
Esta estratégia é um sistema de negociação abrangente que combina vários indicadores técnicos. Ela usa principalmente a média móvel (MA), o índice de força relativa (RSI) e o índice direcional médio (ADX) para identificar tendências e momentum de mercado. O Advanced True Range (ATR) O indicador é usado para definir dinamicamente posições de stop loss e take profit. O sistema adota um método de análise multiperíodo para confirmar sinais de negociação por meio do cruzamento de indicadores em diferentes períodos de tempo, o que não apenas garante a precisão das transações, mas também controla efetivamente os riscos.
A estratégia usa um mecanismo de verificação de três camadas para confirmar sinais de negociação:
Ao mesmo tempo, a estratégia utiliza um sistema dinâmico de stop loss e take profit baseado no ATR:
Essa estratégia cria um sistema de negociação relativamente completo por meio da sinergia de vários indicadores técnicos. A principal vantagem da estratégia está em seu mecanismo de verificação multicamadas e sistema dinâmico de gerenciamento de risco, mas também é preciso prestar atenção à sua adaptabilidade em diferentes ambientes de mercado. Por meio de otimização e melhoria contínuas, espera-se que essa estratégia alcance retornos estáveis em transações reais.
/*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")