
Chiến lược này là một hệ thống giao dịch xác nhận đa tầng kết hợp với đường chéo, chỉ số động lực RSI và chỉ số biến động ATR. Chiến lược sử dụng chỉ số di chuyển trung bình 9 chu kỳ và 21 chu kỳ ((EMA) làm cơ sở phán đoán xu hướng chính, đồng thời xác nhận động lực kết hợp với chỉ số RSI và sử dụng chỉ số ATR để điều chỉnh kích thước vị trí và vị trí dừng lỗ động. Chiến lược này có hiệu quả lọc các tín hiệu giả, tăng độ tin cậy của giao dịch thông qua sự phối hợp đồng bộ của nhiều chỉ số kỹ thuật.
Chiến lược này dựa trên một số khía cạ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 ba chiều của đường chéo, động lực RSI và biến động của ATR. Ưu điểm của chiến lược là cơ chế xác nhận đa cấp và hệ thống quản lý rủi ro động của nó, nhưng có thể phải đối mặt với rủi ro cao hơn trong thị trường biến động.
/*backtest
start: 2025-02-13 00:00:00
end: 2025-02-20 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("BTC Scalping Strategy", overlay=true, margin_long=100, margin_short=100, pyramiding=1)
// Inputs
emaFastLength = input.int(9, "Fast EMA Length")
emaSlowLength = input.int(21, "Slow EMA Length")
rsiLength = input.int(14, "RSI Length")
rsiOverbought = input.int(70, "RSI Overbought")
rsiOversold = input.int(30, "RSI Oversold")
atrLength = input.int(14, "ATR Length")
riskPercent = input.float(1, "Risk Percentage", step=0.5)
// Calculate Indicators
emaFast = ta.ema(close, emaFastLength)
emaSlow = ta.ema(close, emaSlowLength)
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(atrLength)
// Entry Conditions
longCondition = ta.crossover(emaFast, emaSlow) and rsi < rsiOverbought
shortCondition = ta.crossunder(emaFast, emaSlow) and rsi > rsiOversold
// Exit Conditions
takeProfitLevelLong = close + (atr * 3)
stopLossLevelLong = close - (atr * 1.5)
takeProfitLevelShort = close - (atr * 3)
stopLossLevelShort = close + (atr * 1.5)
// Position Sizing
equity = strategy.equity
riskAmount = equity * (riskPercent / 100)
positionSizeLong = riskAmount / (close - stopLossLevelLong)
positionSizeShort = riskAmount / (stopLossLevelShort - close)
// Strategy Execution
if (longCondition)
strategy.entry("Long", strategy.long, qty=positionSizeLong)
strategy.exit("Exit Long", "Long", limit=takeProfitLevelLong, stop=stopLossLevelLong)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=positionSizeShort)
strategy.exit("Exit Short", "Short", limit=takeProfitLevelShort, stop=stopLossLevelShort)
// Plotting
plot(emaFast, color=color.new(color.blue, 0), linewidth=2)
plot(emaSlow, color=color.new(color.red, 0), linewidth=2)
hline(rsiOverbought, "RSI OB", color=color.new(color.red, 50))
hline(rsiOversold, "RSI OS", color=color.new(color.green, 50))
// Alerts
alertcondition(longCondition, "Long Signal", "Potential Long Entry")
alertcondition(shortCondition, "Short Signal", "Potential Short Entry")