Non Repaint Swing Indicator: An 11-Bar Pivot Window

Written by Dominic Walsh · Published · Last updated

The non repaint swing indicator finds pivots the strict way. `Depth` `5` gives an eleven-bar window, and the middle bar must beat every other bar in it. `ConfirmBars` then adds one more closed bar before the mark appears. The most recent swing on each side stays on the chart as a level.

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: Swing High, Swing Low, Recent Swing High, Recent Swing Low
Alerts popup, push notification, email, sound
Inputs 10

What the Non repaint swing Indicator draws on the chart

Swing High places a tomato arrow above a confirmed pivot high.

Swing Low places a lime arrow below a confirmed pivot low.

Recent Swing High and Recent Swing Low are horizontal lines holding the newest level on each side.

`ShowLevels` turns those two lines off if you only want the marks.

  • Swing High: arrow, tomato, width 2, arrow code 234
  • Swing Low: arrow, lime, width 2, arrow code 233
  • Recent Swing High: line, tomato, width 1
  • Recent Swing Low: line, lime, width 1
Non repaint swing indicator on EURUSD H1 with confirmed pivots and swing level lines
Non repaint swing indicator on EURUSD H1 with confirmed pivots and swing level lines

How the Non repaint swing Indicator calculates its values

The eleven-bar window

p takes the bar index plus `ConfirmBars`. is_high starts true and fails if any bar within `Depth` `5` on either side reaches the same high. Five bars each side plus the pivot gives eleven, which is a demanding window.

The extra closed bar

`ConfirmBars` `1` shifts the whole test one bar further into the past. So a pivot needs its five right-hand bars plus one more to close before anything prints. That extra bar is where the non-repaint claim comes from.

Holding the levels

LevelHighBuf and LevelLowBuf carry the newest confirmed price on each side forward across every bar. The two lines therefore run flat until a fresh pivot replaces them. `ShowLevels` gates both buffers.

How to read the signals

A mark confirms six bars after the pivot itself, which is the cost of the strict test.

The two flat lines are the current swing range.

A tight gap between them means the market has been coiling.

Raise `Depth` when you want only the larger turns marked.

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

`EnableAlerts` ships on with `EnablePopup` delivering the text. `EnablePushNotify`, `EnableEmail` and `EnableSound` all start false. `SoundFile` picks the clip. Confirmation runs on closed bars, and the guard allows one pivot message per bar.

Every Non repaint swing Indicator input

Core settings

Setting What it does Default
Depth Fractal half-window (5 = 11-bar window). Bars each side of a pivot, default `5` for an eleven-bar window. 5
ConfirmBars Extra closed-bar buffer (non-repaint). Extra closed bars before a mark prints, default `1`. 1

Display settings

Setting What it does Default
ArrowOffsetPoints Arrow Y offset in points. Mark distance from the bar in points, default `12`. 12
ShowLevels Draw recent swing level lines. Draws the two recent swing level lines, default `true`. on

Alert settings

Setting What it does Default
EnableAlerts Master switch over the pivot alerts, default `true`. on
EnablePopup Terminal dialog on a confirmed pivot, default `true`. on
EnablePushNotify Mobile push on a confirmed pivot, default `false`. off
EnableEmail Mail delivery on a confirmed pivot, default `false`. off
EnableSound Sound playback on a confirmed pivot, default `false`. off
SoundFile Wav file the pivot alert plays, default `alert.wav`. alert.wav
Non repaint swing indicator inputs: Depth, ConfirmBars, ArrowOffsetPoints, ShowLevels
Non repaint swing indicator inputs: Depth, ConfirmBars, ArrowOffsetPoints, ShowLevels

Settings that fit your chart

An eleven-bar window covers a different span on every chart, which is why one setting travels. EURUSD H1 is the reference chart, where a pivot spans eleven hours. On M5 the marks arrive several times a session. On H4 each one describes a swing worth drawing a level from.

When the Non repaint swing Indicator fails

Six bars of delay is a lot. The mark can never land near the extreme in time to act on it.

The two level lines describe the last confirmed swing, which may be well behind current price.

There is no size test, so a shallow pivot in a quiet stretch counts the same as a deep one.

Copy the compiled Non repaint swing 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 Non repaint swing Indicator: Systematic risk on Wikipedia, Pivotpoint at Investopedia.

Download the Non repaint swing Indicator for MT4 and MT5

The zip holds the compiled Non repaint swing 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 wide a window does Depth at 5 create?

Eleven bars in total, five each side of the pivot plus the pivot itself. The middle bar must beat every one of the other ten. That is a strict test, which is why marks are far less frequent than a three-bar fractal would give.

What does ConfirmBars add on top?

One more closed bar of delay. The whole test shifts a bar further back, so a pivot needs its five right-hand bars and that extra bar to finish before printing. It buys certainty at the cost of timing.

What do the Recent Swing High and Low lines show?

The newest confirmed pivot price on each side, carried forward flat until the next one replaces it. Together they bracket the current swing range. `ShowLevels` turns them off if you prefer the arrows on their own.

Does ArrowOffsetPoints at 12 suit EURUSD H1?

It is a small gap, about a pip on a five-digit feed, which keeps the mark tight against the pivot it describes. On instruments with much larger candles raise it, or the arrow will sit inside the bar rather than beside it.

Are results guaranteed?

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

Category: this is part of our Signal and Forecast collection. Browse more Signal and Forecast 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