This article implements the Pesaran–Timmermann directional accuracy test in pure MQL5 and applies its rolling right-tail p-value as a gate to enable or disable an Expert Advisor. Forecasts are scored without look-ahead, and the framework includes an EA, a rolling statistical display, and a self-test. The method is evaluated on XAUUSD, EURUSD and GBPUSD, with a coin-flip control to quantify false alarms.
Say a forecaster gets 58% of next-bar directions right. Is that good? You can't tell until you know how often price went up and how often the forecaster said "up". If the market rose on 60% of bars and the model said "up" 90% of the time, 58% is exactly what a model with no information would score. Pesaran and Timmermann (1992) turned that comparison into a proper test.
Here I implement the test in plain MQL5 and use it as a gate. The EA trades a one-bar direction forecast only when the right-tail p-value of the latest rolling window is below α. That is a screening rule, not proof of skill, and a coin flip runs through the same gate because I wanted to see how often pure noise gets through.
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: Pesaran–Timmermann Test in MQL5: Separating Real Directional Skill from a Lucky Hit Rate.
Say a forecaster gets 58% of next-bar directions right. Is that good? You can't tell until you know how often price went up and how often the forecaster said "up". If the market rose on 60% of bars and the model said "up" 90% of the time, 58% is exactly what a model with no information would score. Pesaran and Timmermann (1992) turned that comparison into a proper test.
Here I implement the test in plain MQL5 and use it as a gate. The EA trades a one-bar direction forecast only when the right-tail p-value of the latest rolling window is below α. That is a screening rule, not proof of skill, and a coin flip runs through the same gate because I wanted to see how often pure noise gets through.
Author: Adewumi Babatunde Gbadebo