Discussing the article: "Manual Backtesting with On-Chart Buttons in the MetaTrader 5 Strategy Tester"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Manual Backtesting with On-Chart Buttons in the MetaTrader 5 Strategy Tester.
Learn how to build a manual backtesting EA for MetaTrader 5's visual tester by adding chart buttons with CButton, executing orders through CTrade, and filtering positions with a magic number. The article implements Buy/Sell and Close All controls, configurable lot size and initial SL, and a trailing stop via CPositionInfo. You will also see how to load indicators with tester.tpl to validate ideas faster before automation and narrow optimization ranges.
A while back, I looked for a way to backtest ideas manually to see whether they made sense and which filters could improve accuracy. This was before I knew MQL5, and I was participating in competitions that encouraged gambling rather than trading. You know them, the ones that are free to enter, change rules from time to time and the first person has tripled their account within a day…..those ones.
I was quite naive thinking that if I could at least get to win one, I could afford to enter prop firm challenges and crown myself an “elite trader”. But after a few losses and hair pulling moments I decided to actually start understanding the game of trading and investing from a mathematical and financial standpoint, and in that pursuit, I found out that my MetaTrader platform had a Strategy Tester.That sent me down the rabbit hole: you can program trading robots (Expert Advisors) and use the Strategy Tester to evaluate strategies and tune parameters.
Having a degree in Information Communication Technology, this was a breeze to understand since the language, MQL5, was more or less C++ with a twist in order to be utilized for trading, but the logic and core principles worked the same way. After a few YouTube videos, countless documentation hours, and a sprinkle of AI, I built a couple of Expert Advisors (EAs). The next hurdle was testing.
At first, I ran single tests because I didn't know about optimization (I thought it optimized code). I kept testing, changing parameters, and testing again. This was the process until I asked ChatGPT if there was a way to automate this process and it led me to the optimization part of the strategy tester. I felt as smart as the smartest rock on earth, but it only took one test to figure out that my fossil of a laptop (I got it from my dad back in 2016, and it wasn’t new back then) couldn’t handle these tests. Well, it could…..but it took days to complete them, and one power outage (which only seemed to occur whenever I did these tests) meant starting from scratch.
Author: Stephen Gathumbi Ndiba