PZ Super Trend Indicator: ATR Bands With ConfirmBars Flip

Written by Dominic Walsh · Published · Last updated

The pz super trend indicator trails price with a single ATR-scaled band. That band flips between an upper and a lower line as the trend changes. It only switches sides once ConfirmBars closed bars agree. A single spike cannot flip the whole line.

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 2: DC-ST Up, DC-ST Dn
Alerts popup, push notification, email, sound
Inputs 9

The visible output

DC-ST Up (medium orchid) plots below price during a bullish trend, acting as a trailing floor.

DC-ST Dn (yellow) plots above price during a bearish trend, acting as a trailing ceiling.

  • DC-ST Up: plot, medium orchid
  • DC-ST Dn: plot, yellow
EURUSD H1 chart: the pz super trend indicator's DC-ST Up band trailing price after a flip.
EURUSD H1 chart: the pz super trend indicator’s DC-ST Up band trailing price after a flip.

The mechanism

ATR bands around the bar midpoint

Every band starts at the bar midpoint. AtrPeriod sets how many bars feed the true range average behind it. The code offsets that midpoint by Multiplier times the ATR reading.

That builds a candidate up band below price and a candidate down band above it. AtrPeriod defaults to 28, and Multiplier defaults to 2.5, so the bands sit fairly wide of price by default.

Trailing and the ConfirmBars flip

Each band only trails one way. The up band cannot fall below its own prior value while price stays above the prior down band. The down band cannot rise above its own prior value while price stays below the prior up band.

A flip between bands needs confirmation. It only commits once ConfirmBars closed bars in a row agree on the new side. ConfirmBars defaults to 2, so one bar poking through is not enough on its own.

Trend state carries between calls

The current trend side and the last band values live in static variables, not in an indicator buffer. They keep their value from one OnCalculate call to the next, rather than resetting on every pass.

That is what lets a flip confirmed several bars ago stay confirmed on the next tick, without the code needing to rescan history to work out which side it was on.

How to interpret it

While DC-ST Up shows below price, the trend reads bullish. That line works as a trailing floor underneath the move.

Once DC-ST Dn appears above price, the trend has flipped bearish. That line works as a trailing ceiling instead.

ConfirmBars needs more than one closed bar to agree. A flip tends to show up a little after the actual turn.

The active side carries forward from one tick to the next through stored state, not a fresh scan of history. A flip only changes that stored state once ConfirmBars agrees.

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

Alerts cover popup, push, email and sound. EnableAlerts fires once per closed bar, right on the bar where the trend flips.

Every PZ Super Trend Indicator input

Core settings

Setting What it does Default
AtrPeriod AtrPeriod sets how many bars feed the ATR average behind both bands. It defaults to 28. 28
Multiplier Multiplier sets how far each band sits from the bar midpoint in ATR units. It defaults to 2.5. 2.5
ConfirmBars ConfirmBars sets how many closed bars must agree before the trend flips sides. It defaults to 2. Setting it to the smallest possible value flips on the very first bar past the band, closer to a classic SuperTrend without the extra confirmation step. 2

Alert settings

Setting What it does Default
EnableAlerts (see inputs panel) on
EnablePopup (see inputs panel) on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Inputs panel for the pz super trend indicator, showing AtrPeriod, Multiplier and ConfirmBars.
Inputs panel for the pz super trend indicator, showing AtrPeriod, Multiplier and ConfirmBars.

Best home for this one

The screenshot runs on EURUSD H1. An AtrPeriod of 28 and a Multiplier of 2.5 keep the bands wide enough to avoid flipping on every small pullback. A shorter AtrPeriod or smaller Multiplier brings the bands closer to price on a faster timeframe. Traders who want faster flips can lower ConfirmBars, trading fewer false flips for a quicker reaction to a fresh turn.

What can go wrong

A range can trap both bands. Price crosses back and forth within the ConfirmBars window, so the trend flips with no lasting move behind it.

The bands trail off the ATR reading. A sudden volatility spike widens both bands right away, which can leave price further from the active band than expected.

The ATR sum behind every band recomputes across AtrPeriod bars each time, so a very long AtrPeriod adds real work per bar without changing the underlying true range formula.

The confirmation window and the band width both come from separate inputs. Tuning one without the other can leave the trend flipping late relative to how tight the bands sit.

Copy the compiled PZ Super Trend 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.

Background reading on the method behind the PZ Super Trend Indicator: Super-voting stock on Wikipedia, Relative Rotation Graphs Rrg Charts at StockCharts ChartSchool.

Download the PZ Super Trend Indicator for MT4 and MT5

The zip holds the compiled PZ Super Trend 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

How does DC-ST Up become DC-ST Dn on this chart?

The two bands never plot together. Once ConfirmBars closed bars agree that price has flipped bearish, the code stops writing DC-ST Up and starts writing DC-ST Dn above price. The reverse flip works the same way on the bullish side.

Why does ConfirmBars exist instead of flipping on the first cross?

Without it, a single bar poking past the active band could flip the trend and then flip straight back on the next bar. Requiring 2 closed bars to agree, the default, trades a small delay for far fewer false flips. Setting the input to its smallest possible value would behave closer to a classic SuperTrend that flips on the very first bar past the band.

What is the practical effect of AtrPeriod 28 versus a shorter window?

AtrPeriod 28 smooths the true range average over roughly a week and a half of H1 bars, so one volatile bar barely moves it. A shorter AtrPeriod would let a single big bar widen both bands right away. That same true range formula also feeds the initial band placement, not just the trailing logic. A wider AtrPeriod also tends to make the bands themselves sit further from price on average, not just react slower.

Can the trailing floor under DC-ST Up ever move down again?

Not while the bullish trend holds. The code will not let the up band fall below its own prior value as long as price stays above the prior down band. It trails upward only, until the trend actually flips. Only a confirmed flip to the bearish side can push DC-ST Up off the chart and replace it with DC-ST Dn.

Does the trend side reset every time the indicator recalculates?

No. The current side and the last band values sit in static variables that carry over from one calculation pass to the next. That is different from a plain indicator buffer, which only stores one value per bar. It is what lets the code remember which side it was on without rescanning the whole chart on every tick.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the PZ Super Trend 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