SuperTrend MT5 Indicator showing ATR trailing stop.
SuperTrend MT5 Indicator is a free RaptozGroup indicator for MetaTrader 5. Retained ATR bands and trend state. Optional higher-timeframe mode maps the previous completed higher-timeframe candle to each chart candle; this confirmation introduces a deliberate delay.
SuperTrend MT5 Indicator Overview
Version 3.00 implementation: Retained ATR bands and trend state. Optional higher-timeframe mode maps the previous completed higher-timeframe candle to each chart candle; this confirmation introduces a deliberate delay. Test on a demo chart; this release does not claim identical results to third-party indicators.
High-Speed SuperTrend ATR Trend Following on MetaTrader 5
The SuperTrend MT5 Indicator is an optimized MQL5 technical tool that plots a non-repainting dynamic trailing stop line directly on the chart based on the Average True Range (ATR) of price.
Utilizing native 64-bit multi-threaded processing, it tracks bullish and bearish trend shifts across all 21 MetaTrader 5 timeframes, rendering non-repainting buy/sell signal arrows and delivering instant mobile push notifications when market trends flip.
Mathematical Formulation of SuperTrend Bands
Pro Trader Execution Rules for SuperTrend Trading
- Trend Direction Anchor: When the SuperTrend line is Green and positioned beneath price, only execute Long trade setups.
- Dynamic Trailing Stop Baseline: Trail your protective stop loss along the SuperTrend line to lock in profits without capping upside potential.
- Higher Timeframe Filter: Only take 5-minute SuperTrend flips when aligned with the 1-Hour or 4-Hour SuperTrend bias.
Supported MT5 Timeframes & Parameter Presets
| Timeframe | Trading Style | Recommended ATR / Multiplier |
|---|---|---|
| M1 / M5 | Fast Scalping | ATR: 7, Multiplier: 2.0 |
| M15 / H1 | Day Trading | ATR: 10, Multiplier: 3.0 |
| H4 / D1 | Swing Trading | ATR: 14, Multiplier: 3.0 |
Key Features & Capabilities
Input Parameters & Settings Guide
Configure the indicator inputs inside MetaTrader MT5 via the Inputs tab upon attaching to your chart:
| Parameter | Default Value | Description | Recommended |
|---|---|---|---|
| ATRPeriod | 10 | Wilder ATR period | Demo-test first |
| Multiplier | 3.0 | ATR band multiplier | Demo-test first |
| Timeframe | PERIOD_CURRENT | Current or higher timeframe; higher TF uses completed candles | Demo-test first |
| PopupAlerts | false | See implementation notes. | Demo-test first |
| PushAlerts | false | See implementation notes. | Demo-test first |
| EmailAlerts | false | See implementation notes. | Demo-test first |
| SoundAlerts | false | See implementation notes. | Demo-test first |
Trading Strategy & Entry Rules
Step 1: Determine Macro SuperTrend
Check H4/D1 to verify that higher timeframe SuperTrend is Green (bullish) or Red (bearish).
Step 2: Enter on Lower Timeframe Flip
On M5/M15, execute in the direction of the macro trend as the line flips and prints a signal arrow.
Step 3: Trail Stop Along Line
Keep moving your stop loss behind the SuperTrend line until price crosses and closes beyond it.
MQL5 Source Code
Loading complete source file…
How to Install & Compile in MetaTrader MT5
Follow this complete step-by-step technical guide to install, compile, and configure the custom MQL5 indicator on your desktop trading terminal:
Download Source File
Download the raw .mq5 source file to your computer using the direct download button below.
Open MT5 Data Folder
Open your MetaTrader terminal, navigate to the top menu bar, click File → Open Data Folder, and open the MQL5 → Indicators subfolder.
Copy & Compile in MetaEditor
Paste the downloaded file into the Indicators directory. Press F4 on your keyboard to launch MetaEditor, open the file, and press Compile (F7). Ensure the compiler reports 0 errors and 0 warnings.
Attach to Chart & Configure
Return to your terminal, refresh the Navigator (Ctrl+N) panel, drag the indicator onto your active chart, and customize input parameters. These downloads do not require DLL imports.
Integrating with Expert Advisors (EA) via iCustom()
Buffer meanings differ between indicators. Check SetIndexBuffer and the plot labels in the complete source before using iCustom. A moving-average value is not a buy signal. Object-based zones and dashboards do not expose their drawings as signal buffers.
How to Set Up Mobile Push Notifications on iOS & Android
To receive the indicator’s supported alerts on your smartphone:
- Install the official MetaTrader MT5 app on your iPhone or Android smartphone.
- Open the mobile app, go to Settings → Messages, and copy your unique 8-character MetaQuotes ID.
- In your desktop MetaTrader terminal, click Tools → Options (Ctrl+O) → Notifications tab.
- Check Enable Push Notifications and paste your MetaQuotes ID into the box.
- Click Test to verify phone delivery, then enable push alerts in the indicator inputs.
Institutional Risk Management & Capital Preservation Protocol
Professional proprietary trading desks operate under strict risk control parameters to ensure longevity:
- Maximum 1% - 2% Risk Rule: Never risk more than 1% to 2% of total account equity on any individual trade setup.
- Minimum 1:2.5 Risk-to-Reward Ratio (RRR): Only execute setups where the potential profit target is at least 2.5 times greater than the stop-loss invalidation distance.
- Multi-Timeframe Confluence Required: Never take an intraday trade against the primary Daily or 4-Hour trend direction.
- High-Impact Economic News Awareness: Avoid entering new positions 15 minutes before and after major macroeconomic data releases (such as US Non-Farm Payrolls, CPI Inflation, and central bank FOMC/ECB interest rate announcements).
Strategy Backtesting & Historical Modeling Protocol
Before deploying any indicator or automated strategy in a live trading environment, professional quants conduct rigorous multi-year backtesting across varying market conditions:
- 99.9% Tick Data Modeling: Use high-precision tick history from reputable data providers (such as Dukascopy or TrueFX) to eliminate spread anomalies and slippage distortion.
- Spread & Commission Inclusion: Always test with realistic variable spreads and broker commission structures to simulate true real-world execution friction.
- Out-of-Sample Walk-Forward Optimization: Avoid curve-fitting by validating parameters on 70% in-sample data and testing robustness on 30% out-of-sample data.
- Monte Carlo Drawdown Analysis: Run randomized trade sequence simulations to calculate the maximum potential drawdown under adverse market volatility regimes.
Virtual Private Server (VPS) & Execution Latency Optimization
For active day traders, scalpers, and automated Expert Advisors, execution speed is paramount:
- Low-Latency Proximity Hosting: Deploy your MetaTrader MT5 terminal on a dedicated Windows VPS located in the same financial data center (e.g. Equinix LD4 in London or NY4 in New York) as your broker server to achieve sub-millisecond execution times.
- Terminal Memory Optimization: Go to Tools → Options → Charts and decrease Max bars in chart to 5,000 to conserve CPU and RAM resources.
- Audio & News Feed Disabling: Turn off unneeded terminal audio event chimes and background news feeds to ensure 100% of CPU cycles are dedicated to indicator calculations.
Common MetaTrader Error Codes & Resolution Matrix
| Error Code | Description | Exact Resolution Action |
|---|---|---|
| ERR_INVALID_STOPS (130) | Stop Loss or Take Profit is too close to current price. | Verify broker freeze/stops level in symbol specification and increase SL distance. |
| ERR_OFF_QUOTES (136) | Broker server has no available liquidity quotes. | Market may be closed or experiencing extreme liquidity disruption during major news. |
| ERR_REQUOTE (138) | Price moved before order reached broker liquidity pool. | Increase slippage tolerance deviation parameter in your order execution settings. |
| ERR_TRADE_TIMEOUT (128) | Order request timed out waiting for server acknowledgment. | Check internet connection latency or migrate terminal to a dedicated trading VPS. |
Institutional Quantitative Trading Lexicon
Broker Execution Models & Raw Spread Compatibility
To achieve optimal performance when using custom technical indicators:
- ECN / Raw Spread Accounts: Use True ECN accounts with 0.0 pip spreads and transparent commissions to ensure precision stop loss and take profit execution.
- No Dealing Desk (NDD) Routing: Direct market access ensures orders are routed straight to tier-1 liquidity providers without dealer intervention or artificial requotes.
- Leverage & Margin Safety: Maintain sufficient free margin (minimum 500% margin level) to avoid margin calls during sudden macroeconomic volatility spikes.
SuperTrend_MultiTimeframe_MT5.mq5
Version: v3.00File Size: 9.4 KBTotal Downloads: 15,000+Access: Free source downloadPlatform: MetaTrader MT5
Already using MetaTrader? Download the compiled .ex5 file and place it in MQL5/Indicators.
Frequently Asked Questions

Quantitative algorithmic trading research desk specializing in MetaTrader MQL4/MQL5 automated systems, institutional order book mechanics, and risk management tools.
