Loading…

Timeframe Robustness Harness

A signal that only makes sense on the exact timeframe you happened to backtest it on is not robust - it is a fitted coincidence. The obvious way to check is to run the same logic on several charts at once and compare, but that means attaching several EAs and manually cross-referencing their logs. This harness does the comparison itself: from one chart it calls iMA() directly against M15, M30, H1, H4 and D1 (any combination can be switched off), because MQL4 can read any timeframe's series without a separate chart for each one - no multi-chart setup is required. Every time the chosen REFERENCE timeframe forms a new closed bar, the harness takes a directional read (fast MA above or below slow MA) on that reference and on every enabled comparison timeframe, then tallies how often each comparison timeframe agreed with the reference. It never sends an order. A CSV report with per-timeframe agreement percentages is written periodically and again when the EA is removed, and a live summary is shown in the chart Comment. Notes and limitations - Report-only. This EA places no orders and manages no positions. - A timeframe with fewer bars of history than InpSlowMaPeriod needs is excluded from that sample's denominator rather than counted as a disagreement. - High agreement across timeframes says the RAW directional read is stable - it says nothing about whether the strategy built on top of that read would actually be profitable on any of them. - The report file accumulates until InpReportEveryNSamples is next reached or the EA is removed from the chart; delete it manually between separate test runs if a clean file is wanted each time.

Expert advisor · MT4 · v1.0 · Free

About Timeframe Robustness Harness

Timeframe Robustness Harness is a script for MetaTrader 4 based on Moving Average. It can alert you with a pop-up, sound, email or push message and can show data from another timeframe (MTF). It has 11 settings, such as Fast ma period, Slow ma period and Ma method. MQL source code included.

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

Settings

SettingDefaultWhat it does
Fast ma period10Fast MA period (same value tested on every timeframe)
Slow ma period30Slow MA period
Ma methodMODE_EMAMA method (0 SMA,1 EMA,2 SMMA,3 LWMA)
Reference timeframePERIOD_H1Timeframe whose new-bar event drives each sample
Test m15trueInclude M15 in the comparison set
Test m30trueInclude M30 in the comparison set
Test h1trueInclude H1 in the comparison set
Test h4trueInclude H4 in the comparison set
Test d1trueInclude D1 in the comparison set
Report every n samples20Write the CSV report after this many new samples
Report file nameTimeframeRobustnessHarness_report.csvReport file, written under MQL4\Files\

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 → Scripts.
  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 script onto a chart to run it once.

Download the PDF guide

Tags: Moving Average · Buy/Sell Arrows · Alerts · Multi-Timeframe (MTF) · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria