Thank you very much for sharing this information and for taking the time to explain it in a very pleasant and readable manner. Excellent.
Regards,
Antonio
Thank you for posting , once again a very unique approach. I am excited interested to understand and implement the appraoch. I comes with such and Informative Explanations, It is a pleasure to read and improves my understanding greatly . Appreciate you time spent creating this
Regards Neil
Thank you for posting, once again a very unique approach. I am excited interested to understand and implement the appraoch. I comes with such and Informative Explanations, It is a pleasure to read and improves my understanding greatly . Appreciate you time spent creating this
Regards Neil
Thank you, Neil, there are so many people that help behind the scenes like Rashid and other content moderators that make all of this possible, we couldn't possibly thank everyone. I'm glad to have added value, that's always the goal. In fact, it's the only goal.
Method Trained() has returned true at that point.
Could it have something to do with being outside trading hours ?
UPDATE: It's likely an issue with historical data. I run in 'real ticks' mode. Trying backtest on one month later of data it works. I'll see if I can add some code that does not let the undefined data slip through undetected. I see there are some checks in there for undefined m[0] and d[0] but may need more of it. I'll check tomorrow.
Trying the LinearRegressionEA on a weekend I get undefined values for values m[0] and b[0] in the LinearRegression,mqh, class Predict() metod thus returns undefined -nan, doing back testing in Strategy Tester.
Method Trained() has returned true at that point.
Could it have something to do with being outside trading hours ?
UPDATE: It's likely an issue with historical data. I run in 'real ticks' mode. Trying backtest on one month later of data it works. I'll see if I can add some code that does not let the undefined data slip through undetected. I see there are some checks in there for undefined m[0] and d[0] but may need more of it. I'll check tomorrow.
My 'every tick' backtest observation got resolved by explicitly exporting Ticks and Bar history data files from the Symbols list and saving them to a file path where the tester will reference them.
The files need to cover the range of days for which tests are performed. This can be convenient for a use case where a period of the past is repeatedly used for improving on a strategy.
By default the tester downloads this data from the net on every test run and apparently sometimes this is not reliable. Keeping this data locally seems to work better.
Usually first time trying to have the tester reference them locally there is some file path acrobatics until coming to know the proper path,
for illustration in my case the Windows path is "C:\Users\<username>\Appdata\Roaming\MetaQuotes\Terminal\Common\Files".
This post provided hints: https://www.mql5.com/en/forum/367098#comment_21816898

- 2021.04.12
- Anthony Eric Gillon Dawson
- www.mql5.com
Trying the LinearRegressionEA on a weekend I get undefined values for values m[0] and b[0] in the LinearRegression,mqh, class Predict() metod thus returns undefined -nan, doing back testing in Strategy Tester.
Method Trained() has returned true at that point.
Could it have something to do with being outside trading hours ?
UPDATE: It's likely an issue with historical data. I run in 'real ticks' mode. Trying backtest on one month later of data it works. I'll see if I can add some code that does not let the undefined data slip through undetected. I see there are some checks in there for undefined m[0] and d[0] but may need more of it. I'll check tomorrow.
There was an inherent tradeoff between keeping the message easy to follow and fixing all the bugs I observed. If I went for the latter, the code may have been necessarily more complex and not as easy to follow as it is. So I decided to keep it easy to follow, with the intentions that you would be able to rapidly extend it.
Your solution sounds very promising, how is it turning out?
My 'every tick' backtest observation got resolved by explicitly exporting Ticks and Bar history data files from the Symbols list and saving them to a file path where the tester will reference them.
The files need to cover the range of days for which tests are performed. This can be convenient for a use case where a period of the past is repeatedly used for improving on a strategy.
By default the tester downloads this data from the net on every test run and apparently sometimes this is not reliable. Keeping this data locally seems to work better.
Usually first time trying to have the tester reference them locally there is some file path acrobatics until coming to know the proper path,
for illustration in my case the Windows path is "C:\Users\<username>\Appdata\Roaming\MetaQuotes\Terminal\Common\Files".
This post provided hints: https://www.mql5.com/en/forum/367098#comment_21816898
Thank you for sharing the link. I'll find time to go through it.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: Build Self Optmising Expert Advisors in MQL5.
Build Expert Advisors that look forward and adjust themselves to any market. Self-optimizing automated systems are essential in today's dynamic financial markets.
MQL5 is ideally suited for this task, contrary to some beliefs. Its API provides extensive matrix and vector functions, allowing for the creation of compact machine learning models. This introduction emphasizes using MQL5 for building self-optimizing bots. An Object-Oriented Programming approach reduces repetitive coding and enhances adaptability across different time frames and market conditions.
Opting for MQL5's matrix and vector capabilities over alternatives like ONNX and Python has considerable benefits. Using an ONNX model would require separate model instances for each trading symbol and new models for any minor parameter changes, such as time frame adjustments. MQL5, however, offers adaptability without the need to manage numerous models for varying conditions.
Author: Gamuchirai Zororo Ndawana