ATR Trend Strategy with Moving Average | Fixed TP/SL version📈 ## ATR Trend Strategy with Moving Average
# Overview
This strategy combines a **Moving Average trend filter** with an **ATR-based breakout channel** to identify directional market movements. It is designed for traders who prefer **systematic trend-following strategies with clearly defined risk management**.
The script builds an adaptive channel around a selected Moving Average using **Average True Range (ATR)**. When price moves beyond the ATR band and the move is confirmed for a defined number of bars, a trend state is established. Trade entries can then occur either on the initial breakout or on a pullback to the Moving Average.
The strategy also includes **fixed percentage Take Profit and Stop Loss levels**, allowing users to evaluate performance under consistent risk parameters.
---
⚙️ # Key Features
• **Multiple Moving Average types**
Supports EMA, SMA, WMA, Hull MA, VWMA, RMA, and TEMA.
• **ATR-based dynamic channel**
Uses ATR to create adaptive upper and lower boundaries around the Moving Average.
• **Two entry methods**
Users can choose between breakout entries or Moving Average pullback entries.
• **Trend confirmation filter**
Signals are confirmed only after a configurable number of bars remain beyond the ATR boundary.
• **Built-in risk management**
Includes fixed percentage Take Profit and Stop Loss levels.
• **Trade visualization**
Displays the TP/SL zone directly on the chart for each trade.
• **Performance statistics panel**
Shows key strategy metrics such as:
* Total trades
* Win rate
* Profit factor
* Net profit
* Expectancy
* Average R
* Maximum drawdown
---
🧠 # Strategy Logic
The strategy follows a simple **trend-following structure** :
1️⃣ A Moving Average defines the market's baseline trend.
2️⃣ An ATR multiplier builds a dynamic volatility channel around the Moving Average.
3️⃣ When price breaks above or below this channel and remains there for a specified number of bars, a trend is confirmed.
4️⃣ Entries can occur via:
**Breakout Mode**
* Long when price breaks above the upper ATR band.
* Short when price breaks below the lower ATR band.
**MA Cross Mode**
* After a confirmed trend, entries occur on pullbacks that cross the Moving Average.
5️⃣ Risk is controlled using **fixed percentage Take Profit and Stop Loss levels**.
---
⚙️ # Inputs
Moving Average
* MA Type
* MA Length
* MA Source
ATR Signal
* ATR Type
* ATR Length
* ATR Multiplier
Trend Confirmation
* Number of confirmation bars
* Confirmation price source (Close or High/Low)
Entry & Risk Management
* Entry method (Breakout or MA Cross)
* Take Profit (%)
* Stop Loss (%)
---
📊 ## Usage Notes
This strategy is designed for **trend-following market conditions** and may perform best in environments with sustained directional movement.
Users are encouraged to **experiment with different Moving Average types, ATR multipliers, and confirmation settings** to adapt the strategy to different markets and timeframes.
---
⚠️ ## Disclaimer
This script is provided for **educational and research purposes only**.
Past performance does not guarantee future results.
---
Strategia Pine Script®






















