
Chiến lược này là một hệ thống giao dịch theo dõi xu hướng kết hợp nhiều chỉ số kỹ thuật. Nó nắm bắt động lực của xu hướng thông qua MACD, sử dụng RSI và StochRSI để xác nhận tình trạng quá mua quá bán và sử dụng chỉ số giao dịch để xác minh hiệu quả của tín hiệu giao dịch. Chiến lược sử dụng cơ chế giảm giá giao dịch động để đảm bảo giao dịch chỉ được thực hiện khi thị trường hoạt động đầy đủ.
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:
Hệ thống mở thêm khi đáp ứng các điều kiện sau:
Hệ thống sẽ mở lỗ nếu đáp ứng các điều kiện sau:
Đề xuất kiểm soát rủi ro:
Chiến lược này xây dựng một hệ thống giao dịch tương đối hoàn chỉnh thông qua sự phối hợp hợp của nhiều chỉ số kỹ thuật. Việc bổ sung cơ chế xác nhận khối lượng giao dịch đã nâng cao độ tin cậy của tín hiệu giao dịch, nhưng hệ thống vẫn cần được hoàn thiện về kiểm soát rủi ro và tối ưu hóa tham số.
/*backtest
start: 2024-02-22 00:00:00
end: 2025-02-19 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("BTCUSDT Strategy with Volume, MACD, RSI, StochRSI", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Input parameters
macdFastLength = input.int(12, title="MACD Fast Length")
macdSlowLength = input.int(26, title="MACD Slow Length")
macdSignalSmoothing = input.int(9, title="MACD Signal Smoothing")
rsiLength = input.int(14, title="RSI Length")
stochRsiLength = input.int(14, title="StochRSI Length")
stochRsiSmoothing = input.int(3, title="StochRSI Smoothing")
stochRsiK = input.int(3, title="StochRSI %K")
stochRsiD = input.int(3, title="StochRSI %D")
volumeThreshold = input.float(1.5, title="Volume Threshold (Multiplier of Average Volume)")
// Calculate indicators
[macdLine, signalLine, _] = ta.macd(close, macdFastLength, macdSlowLength, macdSignalSmoothing)
rsi = ta.rsi(close, rsiLength)
stochRsi = ta.stoch(rsi, rsi, rsi, stochRsiLength)
stochRsiKSmoothed = ta.sma(stochRsi, stochRsiK)
stochRsiDSmoothed = ta.sma(stochRsiKSmoothed, stochRsiD)
averageVolume = ta.sma(volume, 14)
volumeSpike = volume > averageVolume * volumeThreshold
// Entry conditions
longCondition = ta.crossover(macdLine, signalLine) and rsi > 50 and stochRsiKSmoothed > stochRsiDSmoothed and volumeSpike
shortCondition = ta.crossunder(macdLine, signalLine) and rsi < 50 and stochRsiKSmoothed < stochRsiDSmoothed and volumeSpike
// Execute trades
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Plot indicators for visualization
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.red, title="Signal Line")
hline(0, "Zero Line", color=color.black)
plot(rsi, color=color.purple, title="RSI")
plot(stochRsiKSmoothed, color=color.green, title="StochRSI %K")
plot(stochRsiDSmoothed, color=color.orange, title="StochRSI %D")