In this article
After this article, you can
- Separate changed input data from use of future observations.
- Keep an input export with each recorded indicator output.
Terms at hand: Simple Moving Average (SMA) · Trading Journal · Demo account · Trading Plan · Backtesting
A marker visible on a historical low today does not prove it was visible when that low formed. Record both its plotted candle and the first time the signal could be known. Preserve inputs before explaining a changed display; neither one difference nor a short unchanged sample settles every behaviour of an indicator.
Separate calculation, drawing and availability
Pine documentation distinguishes historical and realtime behaviour. An open bar can change; a pivot marker can be added to an earlier candle only after later confirmation. Closing the chart bar does not automatically close a higher-timeframe bar used by the script.
First establish the declared rule: provisional or confirmed, required inputs and possible later relocation. “Non-repaint” alone is not a complete specification. A changed image needs an explanation, but it does not by itself prove deception, look-ahead or a financial loss.
Investigate the specific mechanism
MetaQuotes warns that the last ZigZag segment can change as new data arrives. Its parameters and implementation determine the construction; do not substitute a universal percentage rule. Check provisional-versus-confirmed behaviour separately for other tools such as Parabolic SAR.
MQL5 documents a reset of prev_calculated when deeper history loads or gaps are filled. A saved indicator buffer is therefore not a guarantee of permanent invariance. Keep the input export and program version before attributing a post-restart difference to deliberate rewriting.
Look-ahead occurs when a test assigns a decision earlier than availability of its required information. Deliberately backplotting a later-recognised point is a drawing convention; treating it as an earlier executable signal introduces the timing error. Examine recognition and fill prices separately.
Keep observations that later charts cannot overwrite
Choose one instrument and configuration. Append new records without replacing old ones to match the latest display. A screenshot should show instrument and time scale; it complements an input/output export rather than replacing it. Apply the same evidence discipline when evaluating paid signal services.
| Field | Keep | Purpose |
|---|---|---|
| Environment | Symbol, feed, interval, clock | Compare the same series |
| Tool | Version, parameters, code if available | Separate updates from old-version behaviour |
| Observation | Record time, candle time, open/closed state | Establish information availability |
| Signal | Value, direction, plotted candle, first-seen time | Avoid assigning an earlier entry |
| Comparison | Same fields after later closes and reload | Identify exactly what changed |
Observe during formation, after chart-bar close, after any required higher-timeframe close and after reload. Change one element at a time. Record gaps in observation: lack of a saved signal is not proof that none appeared.
A 10:10 pivot first known at 10:25
Use an explicit fictional M5 rule: High must be strictly greater than the Highs of two completed bars on each side; equality fails. Times denote bar openings, with continuous data and no gaps. This is an assigned model, not an audit of a named commercial tool.
| M5 opens | High | Availability |
|---|---|---|
| 10:00 | 1.1000 | Insufficient data for the selected point |
| 10:05 | 1.1010 | Candidate still ahead |
| 10:10 | 1.1040 | At 10:15 candidate closes; no right neighbours yet |
| 10:15 | 1.1030 | At 10:20 first right neighbour closes |
| 10:20 | 1.1020 | At 10:25 second right neighbour closes; confirmation |
High 1.1040 exceeds all four neighbours. At 10:25 a marker can be drawn at 10:10, but the information became available ten minutes after that candle closed, or fifteen after it opened. These are different reference times for the same delay.
Assume the first possible sell Bid after confirmation was 1.1018. Assigning the historical High 1.1040 as an earlier sell entry adds 0.0022, or 22 pips at pip 0.0001. For exposure 10,000 EUR, that is 22 USD difference in price P/L before fees. No exit was supplied, so this is not a calculated trade profit.
Change only the 10:20 High to 1.1045: the selected 1.1040 no longer qualifies. Equality at 1.1040 would also fail the strict rule. The higher neighbour is not itself a confirmed new pivot without its own required right-side data.
A different reloaded result need not mean future data was used
A saved export has closes 100, 102, 104, so SMA(3)=102. A later export of the same moments has 100, 102, 101, giving SMA(3)=101. The final input price changed. An algorithm using only earlier data can still produce a different result.
Scroll sideways to see the full diagram
Check matching timestamps and price fields, export consistency, indicator version and settings. A future-data append test requires unchanged earlier inputs. A changed export needs a separate diagnosis; this example does not prove the whole program is correct.
Assumptions: Fictional data versions for the same three completed intervals. No cause for the revision or real provider is identified. Formula or data reference: MQL5: history changes in OnCalculate.
Append tests, alert copies and replay have distinct scopes
Compute a completed prefix, append later observations without changing earlier prices, then compare outputs presented as final. A toy rule dividing each price by the maximum of the entire loaded dataset changes its first result from 100/110 = 0.9091 to 100/120 = 0.8333 after appending 120. The earlier price 100 never changed; the decline of about 0.0758 reveals future dependence despite no negative index.
A running-maximum version gives first value 1 in both runs. By contrast, the diagram’s exports 100,102,104 and 100,102,101 change SMA(3) from 102 to 101 because an earlier input was revised. An append test requires unchanged earlier inputs. Passing one prefix check does not prove all code paths correct.
TradingView server alerts retain their creation-time script and settings; later chart edits do not update that copy. Record the alert configuration, trigger frequency and message time. Existing server alerts continue using realtime data during Bar Replay; they are not notifications from the replayed past.
At 10:15 on M5, the hourly 10:00–11:00 bar is still open. Its final High is not available merely because an M5 bar closed. Pine lookahead settings and series offsets require joint analysis. Once availability is specified, move to backtesting with data and costs and walk-forward evaluation. The broader technical-analysis material complements that workflow.
Report a bounded finding
State version, inputs, settings, times and the observed change. Keep both exports and determine whether the input changed. Do not turn five quiet minutes, fifty candles or two weeks into proof of permanent stability or profitability.
If a tool draws a point backwards, record any decision from its actual recognition time. If that time cannot be established, do not assign trades to historical markers. Information-availability checks and performance after execution costs answer different questions.
Check your understanding
One short exercise
About 2 min · you can try again
SMA changes after restart, and the export contains a different Close for the same completed candle. What is the first conclusion?
- Look-ahead is proven.
- The entire indicator is proven correct.
- Investigate the data revision separately and retain both versions.
Check the answer and explanation
Investigate the data revision separately and retain both versions.
Reconcile the inputs first; then evaluate the tool under comparable conditions.
Frequently asked
Does a changed indicator prove a scam?
No. Establish declared behaviour, inputs, version and settings. Open-bar changes, delayed confirmation and revised history are different mechanisms. Preserve both records before assigning a cause; the label “non-repaint” alone is not a complete specification.
Does a closed chart candle settle every signal?
No. Our strict M5 pivot needs two later completed neighbours, and higher-timeframe inputs can still be open. The 10:10 candle closes at 10:15, but the model’s confirmation occurs at 10:25.
Can a short unchanged observation prove no repainting?
No. A short test can reveal a particular difference but cannot exclude every later behaviour. Keep earlier inputs unchanged for an append test and report its exact scope. Revisions to those inputs require separate investigation.
Does stable signal recording establish profitability?
No. Availability and record stability do not determine price fills, costs or net outcomes. Separate the observation protocol from a fully specified trading test; neither a fixed number of bars nor a demo period certifies an edge.
Sources & bibliography
-
MetaQuotes — MQL5 Reference Custom Indicators · Documents indicator buffers, OnCalculate and prev_calculated, including recalculation as new data arrive. www.mql5.com ↗
-
MetaQuotes — MQL5 Reference Organizing Data Access (Timeseries and Indicators Access) · Documents MQL5 access to bar and time-series data, including CopyRates and Bars, for distinguishing completed bars from the current bar. www.mql5.com ↗
-
MQL5 Community Forum Indicator: Repainting to non repainting (MQL5) · A developer-forum discussion of indicator repainting and ways to evaluate signals on closed bars. www.mql5.com ↗
-
CFA Institute Backtesting and Simulation (Refresher Reading) · Discusses strategy-testing biases, including look-ahead and survivorship bias, and their effects on historical results. www.cfainstitute.org ↗
-
TradingView Pine Script v6 — Repainting · The selected sections distinguish open-bar changes, higher-timeframe values, delayed pivot backplotting and data revisions. The M5 times and hypothetical fill prices here are our assigned model. www.tradingview.com ↗
-
MetaQuotes — MQL5 Reference OnCalculate — history updates and prev_calculated · Documents reset after deeper history loads or gaps are filled. A changed historical input is separate from an append test with unchanged earlier data. www.mql5.com ↗
-
TradingView Pine Script v6 — Alerts · Documents saved script/settings copies and trigger-frequency choices. Chart edits do not automatically update an already running alert; a stable alert is not a profitability test. www.tradingview.com ↗
