
Chiến lược này là một hệ thống giao dịch tổng hợp kết hợp đường trung bình di chuyển, chỉ số tương đối mạnh và chỉ số cường độ xu hướng. Bằng cách phối hợp với nhiều chỉ số kỹ thuật, nó có thể nắm bắt chính xác xu hướng thị trường và kiểm soát rủi ro hiệu quả. Hệ thống sử dụng cơ chế dừng lỗ động, đảm bảo tỷ lệ lợi nhuận rủi ro của giao dịch, đồng thời điều chỉnh linh hoạt các tham số chỉ số để thích ứng với môi trường thị trường khác nhau.
Chiến lược dựa trên ba chỉ số cốt lõi: chỉ số di chuyển trung bình nhanh và chậm ((EMA), chỉ số tương đối mạnh ((RSI) và chỉ số xu hướng trung bình ((ADX)). Khi EMA nhanh vượt qua EMA chậm, hệ thống sẽ kiểm tra xem RSI có nằm trong khu vực không mua quá mức (< 60) hay không, đồng thời xác nhận ADX hiển thị cường độ xu hướng đầy đủ (< 15). Khi đáp ứng các điều kiện này, hệ thống sẽ phát ra nhiều tín hiệu.
Chiến lược này tạo ra một hệ thống giao dịch tương đối hoàn chỉnh thông qua việc sử dụng tổng hợp nhiều chỉ số kỹ thuật. Ưu điểm cốt lõi của nó là tăng độ tin cậy của tín hiệu giao dịch thông qua sự phối hợp với các chỉ số, đồng thời đảm bảo sự an toàn của giao dịch thông qua cơ chế kiểm soát rủi ro động. Mặc dù có một số hạn chế vốn có, chiến lược vẫn có thể được cải thiện rất nhiều thông qua hướng tối ưu hóa được đề xuất.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-23 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Enhanced EMA + RSI + ADX Strategy (Focused on 70% Win Rate)", overlay=true)
// Input parameters
lenFast = input.int(9, title="Fast EMA Length", minval=1)
lenSlow = input.int(21, title="Slow EMA Length", minval=1)
rsiPeriod = input.int(14, title="RSI Period")
adxPeriod = input.int(14, title="ADX Period")
adxSmoothing = input.int(1, title="ADX Smoothing")
adxThreshold = input.int(15, title="ADX Threshold")
riskRewardRatio = input.float(1.5, title="Risk/Reward Ratio")
rsiOverbought = input.int(60, title="RSI Overbought Level") // Adjusted for flexibility
rsiOversold = input.int(40, title="RSI Oversold Level")
// EMA Calculations
fastEMA = ta.ema(close, lenFast)
slowEMA = ta.ema(close, lenSlow)
// RSI Calculation
rsiValue = ta.rsi(close, rsiPeriod)
// ADX Calculation
[plusDI, minusDI, adxValue] = ta.dmi(adxPeriod, adxSmoothing)
// Entry Conditions with Confirmation
buyCondition = ta.crossover(fastEMA, slowEMA) and rsiValue < rsiOverbought and adxValue > adxThreshold
sellCondition = ta.crossunder(fastEMA, slowEMA) and rsiValue > rsiOversold and adxValue > adxThreshold
// Dynamic Exit Conditions
takeProfit = strategy.position_avg_price + (close - strategy.position_avg_price) * riskRewardRatio
stopLoss = strategy.position_avg_price - (close - strategy.position_avg_price)
// Entry logic
if (buyCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Sell", from_entry="Buy", limit=takeProfit, stop=stopLoss)
if (sellCondition)
strategy.close("Buy")
// Plotting EMAs
plot(fastEMA, color=color.new(color.green, 0), title="Fast EMA", linewidth=1)
plot(slowEMA, color=color.new(color.red, 0), title="Slow EMA", linewidth=1)
// Entry and exit markers
plotshape(series=buyCondition, style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), size=size.normal, title="Buy Signal")
plotshape(series=sellCondition, style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.normal, title="Sell Signal")
// Alerts
alertcondition(buyCondition, title="Buy Alert", message="Buy signal triggered")
alertcondition(sellCondition, title="Sell Alert", message="Sell signal triggered")