
Strategi ini adalah sistem perdagangan kuantitatif yang menggabungkan beberapa indikator teknis, tiga indikator teknis klasik yang bekerja sama dengan moving average (MA), indikator relatif kuat (RSI) dan dispersi tren rata-rata bergerak (MACD), untuk membangun sistem sinyal perdagangan yang lengkap. Strategi ini menggunakan cara pelacakan tren yang dikombinasikan dengan pengenalan dinamika, dengan memastikan arah perdagangan yang benar, tetapi juga fokus pada peluang.
Strategi ini didasarkan pada tiga tingkatan sinyal perdagangan:
Secara khusus, ketika garis rata-rata cepat ((50 hari) melewati garis rata-rata lambat ((200 hari) membentuk garpu emas, sementara RSI tidak mencapai tingkat overbuy dan MACD membentuk garpu emas, sistem menghasilkan sinyal plus. Sebaliknya, ketika garpu mati muncul dan RSI tidak mencapai tingkat oversell, MACD membentuk garpu mati, sistem menghasilkan sinyal tolak.
Strategi ini dibangun melalui kolaborasi kerjasama dari beberapa indikator teknis, membangun sistem perdagangan yang relatif lengkap. Strategi ini bekerja dengan baik di pasar dengan tren yang jelas, tetapi masih perlu untuk melakukan penyesuaian optimasi sesuai dengan kondisi pasar yang sebenarnya.
/*backtest
start: 2024-06-01 00:00:00
end: 2025-02-18 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © EthioTrader
//@version=5
strategy("Optimal Multi-Indicator Strategy", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.1)
// ===== Input Parameters =====
// Moving Averages
fastMA = ta.sma(close, 50)
slowMA = ta.sma(close, 200)
plot(fastMA, "Fast MA", color=color.green)
plot(slowMA, "Slow MA", color=color.red)
// RSI
rsiLength = input(14, "RSI Length")
rsiOverbought = input(70, "RSI Overbought")
rsiOversold = input(30, "RSI Oversold")
rsi = ta.rsi(close, rsiLength)
// MACD
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
// Risk Management
stopLossPerc = input(2.0, "Stop Loss (%)") / 100
takeProfitPerc = input(4.0, "Take Profit (%)") / 100
trailingStopPerc = input(1.0, "Trailing Stop (%)") / 100
// ===== Strategy Logic =====
// Trend Condition: Golden Cross (Fast MA > Slow MA)
bullishTrend = ta.crossover(fastMA, slowMA)
bearishTrend = ta.crossunder(fastMA, slowMA)
// Momentum Condition: RSI and MACD
bullishMomentum = rsi < rsiOverbought and ta.crossover(macdLine, signalLine)
bearishMomentum = rsi > rsiOversold and ta.crossunder(macdLine, signalLine)
// Entry Signals
longCondition = bullishTrend and bullishMomentum
shortCondition = bearishTrend and bearishMomentum
// Exit Signals
trailingStop = strategy.position_avg_price * (1 - trailingStopPerc)
exitLong = ta.crossunder(close, trailingStop) or (close >= strategy.position_avg_price * (1 + takeProfitPerc))
exitShort = ta.crossover(close, trailingStop) or (close <= strategy.position_avg_price * (1 - takeProfitPerc))
// ===== Execute Orders =====
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=strategy.position_avg_price * (1 - stopLossPerc), limit=strategy.position_avg_price * (1 + takeProfitPerc), trail_price=trailingStop, trail_offset=trailingStopPerc * close)
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=strategy.position_avg_price * (1 + stopLossPerc), limit=strategy.position_avg_price * (1 - takeProfitPerc), trail_price=trailingStop, trail_offset=trailingStopPerc * close)
// ===== Plotting =====
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")