Loading…

Bar Close Versus Intrabar Comparator

"This indicator repaints" is a warning traders hear constantly and mostly cannot see for themselves, because the naive and the non-repainting version of a rule are usually two different files, not two lines on the same chart. This tool puts them side by side on purpose. Both lines implement the identical rule - is the close above its own N-bar simple moving average - but read the data differently. The Intrabar line evaluates the rule using whatever the current bar's price is right now, on every tick, exactly like a naively coded live signal would; on the still-forming current bar this can flip back and forth as price moves. The Bar Close line only ever updates once a bar has actually finished: for the currently forming bar it freezes at whatever the last FULLY CLOSED bar decided, and only moves to a new reading the instant that bar completes. On every historical, already-closed bar the two lines are identical - there is nothing to disagree about once a bar is final. The gap only ever opens up on the current forming bar, and it always closes again the moment that bar finishes. That visible, self-closing gap on the right edge of the chart is exactly what "this rule repaints intrabar" looks like, made concrete instead of abstract. Notes and limitations - REPAINTS ON THE FORMING BAR BY DESIGN - this is an explicit, intentional demonstration of intrabar repaint behaviour, not a defect. Do not use the Intrabar line as a finished trading signal for exactly this reason. - The rule itself (close vs. its own SMA) is deliberately simple so the comparator's behaviour, not the rule's cleverness, stays the point of the tool. - Needs at least InpMaPeriod + 2 bars of history before it plots.

Indicator · MT4 · v1.0 · Free

About Bar Close Versus Intrabar Comparator

Bar Close Versus Intrabar Comparator is an indicator for MetaTrader 4 based on Moving Average. It has 1 setting, such as Ma period. MQL source code included.

Files in the download: BarCloseIntrabarComparator.ex4, BarCloseIntrabarComparator.mq4, BarCloseIntrabarComparator.txt.

Settings

SettingDefaultWhat it does
Ma period20SMA period the comparator rule is built on

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Moving Average · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria