
This strategy is a short-selling mean reversion trading system based on ATR (Average True Range), which identifies overextended price opportunities through dynamic ATR thresholds. The strategy integrates multiple technical indicators, including ATR, EMA, and SMA, forming a comprehensive trading decision framework. When price breaks through the ATR dynamic threshold and meets EMA filter conditions, the system looks for shorting opportunities, aiming to capture mean reversion price movements.
The core logic of the strategy is based on the following key steps: 1. Calculate ATR value over a set period (default 20) to reflect market volatility 2. Multiply ATR by a custom multiplier and add to closing price to construct raw threshold 3. Apply Simple Moving Average (SMA) to smooth the raw threshold and reduce noise 4. Generate short signal when closing price breaks above smoothed ATR signal trigger within specified trading window 5. If EMA filter is enabled, closing price must be below 200-period EMA to execute short 6. Trigger position closure when closing price falls below previous bar’s low
This is a well-designed short strategy that establishes a reliable trading system through ATR dynamic thresholds and EMA trend filtering. The strategy’s strengths lie in its strong adaptability and comprehensive risk control, while attention needs to be paid to risks from changing market environments. Through continuous optimization and improved risk management, the strategy has the potential to maintain stable performance across different market conditions.
/*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()