
Đây là một chiến lược giao dịch định lượng được thiết kế dựa trên nguyên tắc hồi quy trung bình, kết hợp các chỉ số kỹ thuật như Brin Band, chỉ số tương đối mạnh (RSI) và sóng thực trung bình (ATR) để giao dịch bằng cách xác định tình trạng quá mua quá bán trên thị trường. Chiến lược sử dụng thiết lập tỷ lệ lợi nhuận rủi ro thấp để tăng tỷ lệ thắng và kiểm soát rủi ro thông qua quản lý vốn.
Chiến lược này được thực hiện thông qua các phương tiện như:
Chiến lược này xây dựng một hệ thống giao dịch vững chắc bằng cách kết hợp nguyên tắc quay trở về giá trị trung bình và nhiều chỉ số kỹ thuật. Thiết lập tỷ lệ lợi nhuận rủi ro thấp giúp tăng tỷ lệ chiến thắng, trong khi quản lý rủi ro nghiêm ngặt đảm bảo an toàn tài chính. Mặc dù có một số rủi ro vốn có, chiến lược có khả năng đạt được hiệu suất tốt hơn bằng cách tiếp tục tối ưu hóa và hoàn thiện. Đây là một chiến lược phù hợp cho các nhà giao dịch ổn định, đặc biệt là cho các thị trường có tính biến động.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-11-11 00:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("High Win Rate Mean Reversion Strategy for Gold", overlay=true)
// Input Parameters
bbLength = input.int(20, title="Bollinger Bands Length")
bbMult = input.float(2, title="Bollinger Bands Multiplier")
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
atrLength = input.int(14, title="ATR Length")
rrRatio = input.float(0.75, title="Risk/Reward Ratio", step=0.05) // Lower RRR to achieve a high win rate
riskPerTrade = input.float(2.0, title="Risk per Trade (%)", step=0.1) / 100 // 2% risk per trade
// Bollinger Bands Calculation
basis = ta.sma(close, bbLength)
dev = bbMult * ta.stdev(close, bbLength)
upperBand = basis + dev
lowerBand = basis - dev
// RSI Calculation
rsi = ta.rsi(close, rsiLength)
// ATR Calculation for Stop Loss
atr = ta.atr(atrLength)
// Entry Conditions: Mean Reversion
longCondition = close < lowerBand and rsi < rsiOversold
shortCondition = close > upperBand and rsi > rsiOverbought
// Stop Loss and Take Profit based on ATR
longStopLoss = close - atr * 1.0 // 1x ATR stop loss for long trades
shortStopLoss = close + atr * 1.0 // 1x ATR stop loss for short trades
longTakeProfit = close + (close - longStopLoss) * rrRatio // 0.75x ATR take profit
shortTakeProfit = close - (shortStopLoss - close) * rrRatio // 0.75x ATR take profit
// Calculate position size based on risk
equity = strategy.equity
riskAmount = equity * riskPerTrade
qtyLong = riskAmount / (close - longStopLoss)
qtyShort = riskAmount / (shortStopLoss - close)
// Long Trade
if (longCondition)
strategy.entry("Long", strategy.long, qty=qtyLong)
strategy.exit("Take Profit/Stop Loss", from_entry="Long", limit=longTakeProfit, stop=longStopLoss)
// Short Trade
if (shortCondition)
strategy.entry("Short", strategy.short, qty=qtyShort)
strategy.exit("Take Profit/Stop Loss", from_entry="Short", limit=shortTakeProfit, stop=shortStopLoss)
// Plot Bollinger Bands
plot(upperBand, color=color.red, linewidth=2, title="Upper Bollinger Band")
plot(lowerBand, color=color.green, linewidth=2, title="Lower Bollinger Band")
plot(basis, color=color.gray, linewidth=2, title="Bollinger Basis")
// Plot RSI for visual confirmation
hline(rsiOverbought, "Overbought", color=color.red)
hline(rsiOversold, "Oversold", color=color.green)
plot(rsi, color=color.purple, title="RSI")