
Chiến lược này là một chiến lược theo dõi xu hướng kết hợp hệ thống giao thoa đường hai chiều với chỉ số tương đối mạnh ((RSI)). Để nắm bắt xu hướng thị trường bằng cách giao thoa đường trung bình di chuyển 9 chu kỳ với chỉ số 21 chu kỳ ((EMA), đồng thời sử dụng chỉ số RSI để lọc quá mua quá bán và kết hợp xác nhận giao dịch để nâng cao độ tin cậy của tín hiệu giao dịch. Chiến lược này cũng tích hợp cơ chế dừng lỗ động dựa trên độ dao động thực tế ((ATR), thực hiện kiểm soát rủi ro toàn diện.
Logic cốt lõi của chiến lược này dựa trên các yếu tố chính sau:
Khi EMA nhanh đi lên vượt qua EMA chậm và RSI lớn hơn 40 và giao dịch vượt quá ngưỡng, hệ thống tạo ra tín hiệu nhiều. Ngược lại, khi EMA nhanh đi xuống vượt qua EMA chậm và RSI nhỏ hơn 60 và giao dịch được xác nhận, hệ thống tạo ra tín hiệu trống.
Chiến lược này xây dựng một hệ thống theo dõi xu hướng nghiêm ngặt bằng cách kết hợp các chỉ số kỹ thuật cổ điển bằng khoa học. Nhiều cơ chế lọc và phương tiện kiểm soát rủi ro của chiến lược làm cho nó có giá trị ứng dụng thực tế mạnh mẽ.
/*backtest
start: 2024-11-07 00:00:00
end: 2025-02-18 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("Call & Put Options Strategy (Optimized)", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// 📌 Configuration Parameters
emaShort = input(9, title="Short EMA")
emaLong = input(21, title="Long EMA")
rsiLength = input(14, title="RSI Period")
rsiOverbought = input(60, title="RSI Overbought") // Adjusted for more signals
rsiOversold = input(40, title="RSI Oversold") // More flexible to confirm buys
atrLength = input(14, title="ATR Period")
atrMult = input(1.5, title="ATR Multiplier for Stop Loss")
minVol = input(100000, title="Minimum Volume to Confirm Entry") // Volume filter
// 🔹 Indicator Calculations
emaFast = ta.ema(close, emaShort)
emaSlow = ta.ema(close, emaLong)
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(atrLength)
vol = volume
// 📌 Entry Signal Conditions
condCALL = ta.crossover(emaFast, emaSlow) and rsi > rsiOversold and vol > minVol
condPUT = ta.crossunder(emaFast, emaSlow) and rsi < rsiOverbought and vol > minVol
// 🚀 Plot signals on the chart
plotshape(condCALL, location=location.belowbar, color=color.green, style=shape.labelup, title="CALL", size=size.small)
plotshape(condPUT, location=location.abovebar, color=color.red, style=shape.labeldown, title="PUT", size=size.small)
// 🎯 Alert conditions
alertcondition(condCALL, title="CALL Signal", message="📈 CALL signal confirmed")
alertcondition(condPUT, title="PUT Signal", message="📉 PUT signal confirmed")
// 📌 Risk Management - Stop Loss and Take Profit
longStop = close - (atr * atrMult)
shortStop = close + (atr * atrMult)
strategy.entry("CALL", strategy.long, when=condCALL)
strategy.exit("CALL Exit", from_entry="CALL", stop=longStop)
strategy.entry("PUT", strategy.short, when=condPUT)
strategy.exit("PUT Exit", from_entry="PUT", stop=shortStop)