Supertrend Indicator with Trend Color Change

Supertrend Indicator with Trend Color Change
Download ALL MT5 indicators (6043)
YouTube Video Thumbnail



Similar MetaTrader Tools

Supertrend Indicator with Trend Color Change

Info

The Supertrend Indicator with Trend Color Change is a Indicator for MetaTrader 5 that supertrend indicator with trend color changethe idea behind itsupertrend is a popular trend-following tool that functions as a trailing stop. It creates two bands around the price, positioned at a distance of multiplier x ATR, and follows only one band at a time: the lower band during an uptrend and the upper band during a downtrend.

Usage

This tool is typically used for trend following strategies across multiple currency pairs.

Platform

This Indicator works exclusively on MetaTrader 5 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL5/Indicators folder via File ? Open Data Folder in MetaTrader 5.


How to Install and Use Supertrend Indicator with Trend Color Change

1. Installation: Place your file in the MQL/Indicators folder via "Open Data Folder" and restart your terminal.

2. Loading: Find the indicator in the Navigator, drag it onto your chart, and configure the input parameters in the popup window.

3. Customization: Press Ctrl+I to open the indicator list, select your tool, and click "Properties" to change colors, levels, or visual styles.

4. Updating: Replace the old file in the Indicators folder with the new version and restart the platform to apply changes.

Frequently Asked Questions

Q: Why is my indicator not showing? A: Verify the file is in the MQL/Indicators folder, or try right-clicking the "Indicators" tree in the Navigator and clicking "Refresh."

Q: Do custom indicators slow down the platform? A: Too many complex indicators can impact performance; remove unused ones via the "Indicator List" (Ctrl+I).

Q: Can I use MT4 indicators on MT5? A: No, MQL4 and MQL5 are distinct languages; ensure the indicator is compiled specifically for your platform version.

What this tool does

Supertrend Indicator with Trend Color ChangeThe Idea Behind ItSupertrend is a popular trend-following tool that functions as a trailing stop.

Typical Use Case

This Indicator excels in trend following on MetaTrader 5.

Compatible Platform & Setup

This Indicator works on MetaTrader 5. Place the file in the MQL5/Indicators folder and restart the terminal.

Description & Settings

Related: Relative Volume (RVOL) Indicator in a Subwindow - another powerful indicator for MetaTrader 5 traders.

Supertrend Indicator with Trend Color Change

Also recommended: Warm-Up Meter: Quantifying Recursive Indicator Convergence - similar indicator with strong performance on MetaTrader 5.


The Idea Behind It

Supertrend is a popular trend-following tool that functions as a trailing stop. It creates two bands around the price, positioned at a distance of multiplier x ATR, and follows only one band at a time: the lower band during an uptrend and the upper band during a downtrend. A band can only move in the direction of the trend, effectively trailing the price and not reversing.

When the closing price crosses the active line, the trend is considered to have changed. The indicator switches to the opposite band, the line moves to the other side of the price, and its color changes. Because the band distance is determined by ATR, the indicator adapts to market volatility.

The ATR (Wilder smoothing) is calculated internally by the indicator, eliminating the need for external indicator handles. Only the last bar is recalculated on each tick, with the entire history processed just once.

How to Interpret It

Uptrend Line (solid, white by default) - Drawn below the price. It serves as dynamic support and a trailing stop level for long positions.

Downtrend Line (dashed, gray by default) - Drawn above the price. It acts as dynamic resistance and a trailing stop level for short positions.

Color Change - The line changes color and moves to the opposite side of the price when a candle closes beyond it, signaling a trend change.

Buy Arrow - Appears on the bar where the trend shifts from down to up.

Sell Arrow - Appears on the bar where the trend shifts from up to down.

Info Label (top-left corner) - Displays the indicator's settings and the current trend direction (UP or DOWN).

Supertrend performs best in trending markets. In sideways markets, it may generate frequent changes and false signals, making it suitable for use with a higher timeframe filter or other confirmation tools.

External Variables (Inputs)

Input

Default

Purpose

Supertrend

InpAtrPeriod

10

ATR period (1 and above)

InpMultiplier

3.0

ATR multiplier; a larger value results in wider bands and fewer signals (greater than 0)

InpPriceSource

ST_SRC_MEDIAN

Price used for band calculation: ST_SRC_MEDIAN (High+Low)/2 or ST_SRC_CLOSE

Appearance

InpUpColor

clrWhite

Color of the line during an uptrend

InpDownColor

clrGray

Color of the line during a downtrend

InpUpStyle

STYLE_SOLID

Line style during an uptrend

InpDownStyle

STYLE_DASH

Line style during a downtrend

InpLineWidth

1

Line width (1 to 5). Dash and dot styles are only displayed with width 1

Signals

InpShowArrows

true

Display arrows when the trend changes

InpBuyColor

clrWhite

Color of the buy arrow

InpSellColor

clrSilver

Color of the sell arrow

InpAlerts

false

Trigger an alert when a closed bar changes the trend

Info Label

InpShowInfo

true

Display the info label with the current trend

InpInfoColor

clrWhite

Color of the info label

Recommended Use

This indicator is effective on any symbol and timeframe. The default settings (ATR 10, multiplier 3.0) provide a common starting point. Adjusting the multiplier allows for more sensitive signals with a smaller value or fewer, more robust signals with a larger value.

Values and arrows on closed bars remain constant. On the current, forming bar, the line and arrow may change or disappear as the signal depends on the current closing price. It is advisable to wait for the bar to close before making trading decisions.

Alerts are generated only for the most recent closed bar, occurring once per bar. Historical signals do not trigger alerts when the indicator is initially applied.

Avoid using the arrows as a standalone trading system, as sideways markets can lead to whipsaws. The trailing stop functionality of the line itself is its most valuable application.

The indicator requires a minimum number of bars, exceeding the ATR period, before it begins to display.

As a chart indicator, it does not execute trades and functions identically on both netting and hedging accounts.

The info label uses the prefix Supertrend_ and is automatically removed when the indicator is deleted from the chart.

Fig. 1. SupertrendColor on an H1 chart with default settings.

You may also like: Chart Pattern Breakout Indicator - excellent alternative for indicator users on MetaTrader 5.

Source Code

#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version     "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_plots   4
#property indicator_label1  "Supertrend Up"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrWhite

.......

Leave your opinion, ask a question, share some knowledge

⚠ Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.