This strategy combines Exponential Moving Averages (EMA) with a Stop-Loss based on the Average True Range (ATR) to create a robust trend-following system with volatility-based risk management.
Features:
Exponential Moving Averages (EMA):
Tracks short-term (9-period) and mid-term (21-period) trends. Crossover signals indicate bullish or bearish trends for trade entries. Average True Range (ATR):
Dynamically calculates Stop-Loss levels based on market volatility. Protects trades by adapting to changing market conditions. Entry and Exit Conditions:
Long Entry: Triggered when EMA 9 crosses above EMA 21 (bullish crossover). Short Entry: Triggered when EMA 9 crosses below EMA 21 (bearish crossover). Positions are exited when the Stop-Loss level, calculated using ATR, is hit. Customization Options:
Adjust the periods for EMA and ATR to suit different trading styles or markets. Modify the ATR multiplier for tighter or looser Stop-Loss levels. Visualization:
EMA 9 and EMA 21 are plotted directly on the price chart for clear trend identification. ATR-based Stop-Loss levels are dynamically calculated for each trade. This strategy is designed for educational and testing purposes. Use it as a foundation for further backtesting and adapting to your trading approach.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.