Trading Strategy Based on Supply and Demand Zones with EMA and Trailing Stop
Overview
The strategy utilizes supply and demand zones, Exponential Moving Average (EMA), and Average True Range (ATR) trailing stop for trade signals. Users can adjust EMA settings and signal visibility. The strategy marks Higher High (HH), Lower Low (LL), Lower High (LH), and Higher Low (HL) zones. Signals are shown after the third candle, suitable for backtesting.
Strategy Logic
Indicator Calculations
Exponential Moving Average (EMA):
- EMA is calculated from closing prices over a period (default: 200).
- Formula: EMA = (Price_t x α) + (EMA_t-1 x (1 - α)), where α = 2/(length + 1)
Average True Range (ATR):
- ATR measures market volatility from true range of prices.
- True range is the greatest of:
- Current high minus current low
- Absolute value of current high minus previous close
- Absolute value of current low minus previous close
- ATR typically uses 14 periods.
Used to determine EMA for trend and ATR for volatility-based trailing stop.
Supply and Demand Zone Identification
It identifies "HH" (Higher High), "LL" (Lower Low), "HL" (Higher Low) and "LH" (Lower High) patterns:
-
Higher High (HH): Current peak > previous peak, upward momentum.
-
Lower Low (LL): Current trough < previous trough, downward momentum.
-
Higher Low (HL): Current trough > previous trough, upward continuation.
-
Lower High (LH): Current peak < previous peak, downward continuation.
Used with trends to identify reversals or continuations.
Entry and Exit
Entry Signal: Buy/sell on third candle closing above/below previous high/low.
Exit: Trailing stop loss based on ATR.
Advantages
- Combines trends, reversals, volatility for robust signals.
- Demand/supply zones identify key S/R.
- Dynamic ATR stop adjusts to volatility.
- Customizable parameters.
- Simple entry rules.
Risks and Improvements
- False signals: Optimize EMA length.
- High ATR multiplier risks chasing trends.
- Consider additional filters on entries.
- Test trend-focused approach.
Conclusion
Combines multiple techniques for decent backtests. Real-world is complex, optimization is key. Basic strategy allows extensions and combinations.
/*backtest
start: 2023-12-18 00:00:00
end: 2024-01-17 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Supply and Demand Zones with EMA and Trailing Stop", shorttitle="SD Zones", overlay=true)
showBuySignals = input(true, title="Show Buy Signals", group="Signals")- 1

