TAYU Academy course material · MQL5 EA Programming Intro
Course Notes
1. Understand the core idea of “Parameter optimisation” and explain it in your own words
2. Master this module's focus: Backtesting and optimisation
3. Complete the assignment on your own and check it against the reference answer
Parameter optimization is merely searching within a given model and cannot automatically discover robust advantages. Parameters of a read-only Expert Advisor (EA) can compare signal frequencies, but they cannot calculate the true strategy returns during actual execution.
In the MT5 Strategy Tester, select the "Based on Real Tick Spreads" mode and set the actual spread and commission. Be mindful of overfitting during optimization and use walk-forward testing, retaining the out-of-sample interval. Passing the backtest does not equate to effectiveness in live trading.
Optimize for the period of the moving average 10–50, and validate within the "walk-forward test 1/4" interval; if the forward test result shows a significant decline, then abandon this set of parameters.
Record grid parameters and trial numbers → only in the training zone → select neighbors → freeze → check future zone for indicators → determine if signals or trades.
If you only count logged crossovers for 20 moving-average pairs, can you pick the pair with the most and call it the most profitable setting?
Cannot, the number of times it crosses above is not an indicator of profit or risk. It needs to be independently defined for execution, fees, and risk, and then studied, and validated using data that was not involved in the parameter selection.
The parameters trained on the 10/30 dataset showed good results, but the out-of-sample difference was noticeable. After slightly modifying the parameters on the 11/31 dataset, the results changed significantly, indicating instability. Only record signals; examples should report the number of signals, the time, and repeat checks. Verification of gains should use an offline script for the course, separate from the MT5 real strategy backtest.
Optimisation must not select on final test returns; signal counts must not be swapped for fill counts.
The companion .mq5 file only logs signals and never submits orders. Below is a terminal checklist; having the source on the web does not mean it has compiled or run in your terminal. Without a terminal, complete the state machine on paper and record which steps were not run.
1. Download AcademySmaSignal.mq5
2. Open and compile it in MT5 MetaEditor; save the version and diagnostics
3. Watch new-bar signal logs on a demo chart or in the Strategy Tester only
4. Check CopyBuffer failures, duplicate new-bar events and resource release on exit
5. Do not enable live trading; verify the order state machine on paper1. Use real-tick mode
2. Run a walk-forward test
3. Passing a backtest does not mean it works live
Risk warning: leveraged trading in forex, precious metals and similar products carries a high level of risk and you may lose all of your capital, or more. This course is for education only. It is not investment advice and does not promise any return. Example prices and contract specifications are teaching assumptions; always use what your own platform discloses. Past performance and backtests do not indicate future results.
All values, prices, accounts and cases in this course are teaching assumptions; the fixed materials can be reproduced offline. Marking a lesson complete only records your study. It is not a certification, a service approval or a promise of returns. Workbooks and answer files are currently provided in Chinese.
Key Takeaways
Completion records your own study, not verified competence. Exercises use fictional data; no real account or deposit is required.