Non Repainting Supertrend Indicator MT4 + MT5

Written by Dominic Walsh · Published · Last updated

The non repainting supertrend indicator builds the standard ATR-banded trend line and adds a CooldownBars gap between flips so a single spike cannot flip the trend back and forth on consecutive bars. It suits trend traders who want the classic Supertrend read with a small whipsaw filter built in.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 4: Supertrend Up, Supertrend Down, Buy Flip, Sell Flip
Alerts popup, push notification, email, sound
Inputs 10

What the Non Repainting Supertrend Indicator draws on the chart

Supertrend Up draws a dodger-blue line under price while the trend reads up.

Supertrend Down draws a tomato line above price while the trend reads down.

Buy Flip prints a lime arrow (code 233) and Sell Flip a red arrow (code 234), both marking the bar where the trend direction changes.

  • Supertrend Up: line, dodger blue, width 2
  • Supertrend Down: line, tomato, width 2
  • Buy Flip: arrow, lime, width 1, arrow code 233
  • Sell Flip: arrow, red, width 1, arrow code 234
Non repainting supertrend indicator on EURUSD H1 with the ATR bands and flip arrows.
Non repainting supertrend indicator on EURUSD H1 with the ATR bands and flip arrows.

How the Non Repainting Supertrend Indicator calculates its values

ATR bands around the bar midpoint

ATRPeriod, `14`, feeds a Wilder-style average true range that the code seeds with a plain average at the start of the calculated range, then recurses forward from there.

Multiplier, `3.0`, scales that ATR into an offset from the bar’s high/low midpoint, which produces a basic upper band and a basic lower band the same way the original Supertrend formula does.

Trailing line and the cooldown gap

The code only lets the trailing line move in the direction that tightens toward price; it holds the line steady rather than loosening it back away from price while the trend continues. When the close crosses to the other side of that trailing line, the code flips direction and marks Buy Flip or Sell Flip.

CooldownBars, `3`, sets a minimum bar gap the code holds between one flip and the next, the mechanism that stops a single wick from flipping the trend twice in quick succession.

What the cooldown actually blocks

CooldownBars does not stop the underlying trailing line from crossing price; it only stops the code from acting on a second flip inside its window. The line can still touch or cross the close during a cooldown, the code just withholds the Buy Flip or Sell Flip mark until the gap has passed.

Once CooldownBars elapses, the next qualifying cross is free to flip the trend again, even if that next cross comes only one bar after the cooldown ends.

How to read the signals

A dodger-blue Supertrend Up line under price marks an up trend read.

A tomato Supertrend Down line above price marks a down trend read.

The exact bar where the trend direction changed carries a Buy Flip or Sell Flip arrow, gated by the CooldownBars minimum gap.

No flip arrows across a long, same-colour stretch of the line means the trend held steady and the CooldownBars gate never had to step in.

A flip arrow appearing right after a visibly small wick, rather than a clean cross, is the case CooldownBars is built to reduce, not eliminate.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

Alerts cover popup, push, email and sound, and fire once per closed bar.

Every Non Repainting Supertrend Indicator input

Core settings

Setting What it does Default
ATRPeriod ATR lookback. ATR lookback behind the band width; default `14`. 14
Multiplier ATR multiplier (band width). ATR multiplier that sets how far the bands sit from price; default `3.0`. 3.0
CooldownBars bars between flips. Minimum bars held between one flip and the next; default `3`. 3

Display settings

Setting What it does Default
ArrowOffsetPts arrow offset in points. 12

Alert settings

Setting What it does Default
EnableAlerts master alert toggle. on
EnablePopup popup alerts. on
EnablePushNotify push to mobile MT. off
EnableEmail email alerts. off
EnableSound sound alerts. on
SoundFile sound file. alert.wav
Inputs panel for the non repainting supertrend indicator showing ATRPeriod and Multiplier.
Inputs panel for the non repainting supertrend indicator showing ATRPeriod and Multiplier.

Settings that fit your chart

The Supertrend formula works on any liquid instrument and timeframe; the screenshot below uses EURUSD H1 with the default Multiplier of `3.0`.

When the Non Repainting Supertrend Indicator fails

In a ranging market the trailing line sits close to price on both sides, so even with CooldownBars gating the flips, a sideways stretch still produces more flips than a genuine trend would.

Raising Multiplier widens the bands and cuts flips, but it also pushes the line further from price, giving back more open profit before the code confirms a real reversal.

CooldownBars only blocks a flip from firing again within its window; it does not undo a flip that already happened on a bar that turns out to be a spike.

A CooldownBars value set too high can delay a genuine reversal mark by several bars after the trailing line has already crossed, since the code withholds the flip until the gap has passed.

Copy the compiled Non Repainting Supertrend Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Non Repainting Supertrend Indicator for MT4 and MT5

The zip holds the compiled Non Repainting Supertrend Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What does CooldownBars do?

CooldownBars sets a minimum number of bars, `3` by default, that must pass before the trend can flip again after a Buy Flip or Sell Flip. It is the filter that stops one spike from flipping the line back and forth in consecutive bars.

How does the code build the Supertrend line?

ATRPeriod feeds a Wilder-style average true range, and Multiplier scales that ATR into an offset from the bar’s midpoint, which produces the upper and lower bands the trailing line draws from.

Why does the Supertrend Up line only tighten toward price?

That rule is the standard Supertrend trailing behaviour: the code only lets the active band move closer to price while the current trend holds, which makes it act as a trailing stop rather than a simple moving offset.

What happens if I lower Multiplier?

Lowering Multiplier pulls the bands closer to price, so the trailing line reacts faster and flips direction sooner, at the cost of more flips during ordinary volatility.

Can the trailing line cross price during a cooldown without a flip printing?

Yes. CooldownBars only withholds the Buy Flip or Sell Flip mark; it does not stop the underlying line from crossing the close. The code waits out the gap before it will mark the next flip.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Non Repainting Supertrend Indicator as one input. Always backtest before trading live.

Category: this is part of our Trend collection. Browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment