
Đây là một chiến lược giao dịch định lượng nâng cao kết hợp đường trung bình động hàm mũ (EMA), xác nhận khối lượng và chỉ báo tỷ lệ xu hướng trung bình (ATR). Chiến lược này sử dụng nhiều chỉ báo kỹ thuật không chỉ để nắm bắt chính xác xu hướng thị trường mà còn cải thiện độ tin cậy của giao dịch thông qua xác nhận khối lượng. Đồng thời, nó sử dụng ATR để điều chỉnh động các vị thế dừng lỗ và chốt lời, do đó hiện thực hóa một hệ thống quản lý rủi ro toàn diện .
Logic cốt lõi của chiến lược bao gồm ba phần chính:
Chiến lược này thiết lập một hệ thống giao dịch logic chặt chẽ bằng cách sử dụng toàn diện nhiều chỉ báo kỹ thuật. Ưu điểm cốt lõi của chiến lược này nằm ở nhiều cơ chế xác nhận và quản lý rủi ro năng động, nhưng cũng cần phải chú ý đến những rủi ro như đảo ngược xu hướng và đột phá khối lượng sai. Thông qua quá trình tối ưu hóa và cải tiến liên tục, chiến lược này dự kiến sẽ đạt được hiệu suất tốt hơn trong các giao dịch thực tế.
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-16 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=5
strategy("Enhanced Volume + Trend Strategy", overlay=true)
// Inputs
emaLength = input.int(50, title="EMA Length")
atrLength = input.int(14, title="ATR Length")
atrMultiplierSL = input.float(2.0, title="ATR Multiplier for Stop Loss")
atrMultiplierTP = input.float(3.0, title="ATR Multiplier for Take Profit")
volLength = input.int(20, title="Volume Moving Average Length")
volMultiplier = input.float(1.5, title="Volume Multiplier (Relative to Previous Volume)")
// Trend Detection using EMA
ema = ta.ema(close, emaLength)
// ATR Calculation for Stop Loss/Take Profit
atr = ta.atr(atrLength)
// Volume Moving Average
volMA = ta.sma(volume, volLength)
// Additional Volume Condition (Current Volume > Previous Volume + Multiplier)
volCondition = volume > volMA * volMultiplier and volume > volume[1]
// Entry Conditions based on Trend (EMA) and Volume (Volume Moving Average)
longCondition = close > ema and volCondition
shortCondition = close < ema and volCondition
// Stop Loss and Take Profit Levels
longStopLoss = close - (atr * atrMultiplierSL)
longTakeProfit = close + (atr * atrMultiplierTP)
shortStopLoss = close + (atr * atrMultiplierSL)
shortTakeProfit = close - (atr * atrMultiplierTP)
// Strategy Execution
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Long", stop=longStopLoss, limit=longTakeProfit)
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Short", stop=shortStopLoss, limit=shortTakeProfit)
// Plotting EMA
plot(ema, color=color.yellow, title="EMA")
// Plot Volume Moving Average
plot(volMA, color=color.blue, title="Volume Moving Average")
// Signal Visualizations
plotshape(series=longCondition, color=color.green, style=shape.labelup, location=location.belowbar, title="Buy Signal")
plotshape(series=shortCondition, color=color.red, style=shape.labeldown, location=location.abovebar, title="Sell Signal")