What is SuperTrend V5?
SuperTrend is one of the most widely used trend-following indicators in technical analysis. Version 5 of this AmiBroker AFL is a comprehensive upgrade that combines the classic ATR-based SuperTrend calculation with a full alert system and a real-time GFX graphical dashboard overlaid directly on the price chart.
Originally developed by Rajandran R of marketcalls.in, this version adds popup window alerts with de-duplication (so you don't get spammed with repeated alerts), sound file playback, and gradient GFX data panels that display the current signal state without leaving the chart.
Technical Specifications
How SuperTrend Works
SuperTrend calculates two dynamic bands around price using the Average True Range (ATR):
- โฒUpper Band (Resistance) = MA(High, Period) + Multiplier ร ATR(Period)
- โผLower Band (Support) = MA(Low, Period) โ Multiplier ร ATR(Period)
When price closes above the upper band โ trend flips to Bullish โ Buy signal generated.
When price closes below the lower band โ trend flips to Bearish โ Sell signal generated.
The trailing stop adjusts dynamically with every new ATR value, widening during volatile periods and tightening in calm conditions โ allowing you to stay in trends longer while protecting profits.
Key Code Sections
Configurable Parameters
| Parameter | Default | Range | Description |
|---|---|---|---|
ATR Period | 7 | 3โ50 | Lookback period for ATR calculation. Lower = more sensitive, higher = smoother. |
ATR Multiplier | 3.0 | 1.5โ5.0 | Band width multiplier. Higher = wider stops, fewer signals. |
Candle UP Color | Green | Any | Bullish candle body color |
Candle Down Color | Red | Any | Bearish candle body color |
Background Color | Black | Any | Chart background (black recommended for dark trading terminals) |
Alert Timeout | 10s | 5โ60s | How long the popup alert stays on screen |
Installation Instructions
Download the AFL
Click the โฌ Download button above. Save SuperTrend-V5.afl to your computer.
Copy to AmiBroker Formulas Folder
Copy the file to: C:\Program Files\AmiBroker\Formulas\Custom\
Create the Custom folder if it doesn't exist.
Apply to Chart
Open AmiBroker โ Right-click on chart โ Insert Indicator โ Navigate to Custom โ SuperTrend Ver 5.0 โ Click OK.
Tune Parameters
Right-click chart โ Parameters to adjust ATR period and multiplier. Start with defaults (7, 3.0) and optimize for your instrument.
Trading Tips & Best Practices
Works Best When
Market is trending with clear directional bias. Use on Nifty Futures, BankNifty, MCX Gold and Crude for best results on 5-min charts.
Avoid When
Market is in a tight range near major support/resistance. During news events, expiry days, or pre-market opening gaps that distort ATR.