
Chiến lược này là một hệ thống giao dịch đảo ngược giảm giá dựa trên ATR, chủ yếu bằng cách tính toán ngưỡng ATR động để xác định cơ hội kéo dài giá quá mức. Chiến lược này tích hợp nhiều chỉ số kỹ thuật bao gồm ATR, EMA và SMA để tạo thành một khung quyết định giao dịch hoàn chỉnh.
Logic cốt lõi của chiến lược này dựa trên các bước chính sau:
Đây là một chiến lược giao dịch được thiết kế tốt, xây dựng một hệ thống giao dịch đáng tin cậy thông qua ATR giảm giá động và lọc xu hướng EMA. Ưu điểm của chiến lược là nó có khả năng thích ứng và kiểm soát rủi ro tốt, nhưng cũng cần chú ý đến rủi ro do môi trường thị trường thay đổi. Bằng cách tiếp tục tối ưu hóa và cải thiện quản lý rủi ro, chiến lược này có thể duy trì hiệu suất ổn định trong các môi trường thị trường khác nhau.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("[SHORT ONLY] ATR Sell the Rip Mean Reversion Strategy", overlay=true, initial_capital = 1000000, default_qty_value = 100, default_qty_type = strategy.percent_of_equity, process_orders_on_close = true, margin_long = 5, margin_short = 5, calc_on_every_tick = true, fill_orders_on_standard_ohlc = true)
//#region INPUTS SECTION
// ============================================
// ============================================
// Strategy Settings
// ============================================
atrPeriod = input.int(title="ATR Period", defval=20, minval=1, group="Strategy Settings")
atrMultInput = input.float(title='ATR Multiplier', defval=1.0, step=0.25, group="Strategy Settings")
smoothPeriodInput = input.int(title='Smoothing Period', defval=10, minval=1, group="Strategy Settings")
//#endregion
// ============================================
// EMA Filter Settings
// ============================================
useEmaFilter = input.bool(true, "Use EMA Filter", group="Trend Filter")
emaPeriodInput = input.int(200, "EMA Period", minval=1, group="Trend Filter")
//#region INDICATOR CALCULATIONS
// ============================================
// Calculate ATR Signal Trigger
// ============================================
atrValue = ta.atr(atrPeriod)
atrThreshold = close + atrValue * atrMultInput
signalTrigger = ta.sma(atrThreshold, smoothPeriodInput)
plot(signalTrigger, title="Smoothed ATR Trigger", color=color.white)
// ============================================
// Trend Filter
// ============================================
ma200 = ta.ema(close, emaPeriodInput)
plot(ma200, color=color.red, force_overlay=true)
//#region TRADING CONDITIONS
// ============================================
// Entry/Exit Logic
// ============================================
shortCondition = close>signalTrigger
exitCondition = close<low[1]
// Apply EMA Filter if enabled
if useEmaFilter
shortCondition := shortCondition and close < ma200
//#endregion
if shortCondition
strategy.entry("Short", strategy.short)
if exitCondition
strategy.close_all()