Look-ahead errors arise when a decision consumes values that did not yet exist, such as a partially formed higher-timeframe bar. This MQL5 library logs input timing metadata and validates declarations against the decision time with eight ordered rules, returning PASS, WARNING, or FAIL and a named violation. A demo EA plus twelve deterministic tests at a fixed timestamp illustrate correct and failing cases.
An Expert Advisor opens a BUY on EURUSD at 12:35 on the M5 chart and reads an H1 trend value. Was the value available at 12:35, or does it reflect the H1 candle's final close at 13:00? An equity curve cannot answer that question.
A forming candle is not automatically evidence of look-ahead: an Expert Advisor may use its current value under an intrabar policy. The key is to establish which value was used, when it became available, and whether that timing is consistent with the decision policy.
This article builds an MQL5 library to make those assumptions explicit. You will learn how to record the inputs behind a decision, select a closed-bar or intrabar policy, and reproduce named validation failures with deterministic scenarios. The audit checks declared timing only. It cannot detect an input that was not recorded, or prove that an indicator did not repaint.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: Temporal Causality Audit in MQL5: Validating Recorded Dependencies Against the Decision Time.
An Expert Advisor opens a BUY on EURUSD at 12:35 on the M5 chart and reads an H1 trend value. Was the value available at 12:35, or does it reflect the H1 candle's final close at 13:00? An equity curve cannot answer that question.
A forming candle is not automatically evidence of look-ahead: an Expert Advisor may use its current value under an intrabar policy. The key is to establish which value was used, when it became available, and whether that timing is consistent with the decision policy.
This article builds an MQL5 library to make those assumptions explicit. You will learn how to record the inputs behind a decision, select a closed-bar or intrabar policy, and reproduce named validation failures with deterministic scenarios. The audit checks declared timing only. It cannot detect an input that was not recorded, or prove that an indicator did not repaint.
Author: Stanley Kimathi Kibaara