Here are few steps to optimize a strategy after successful coding
MT5 Strategy Tester in visualization mode has a drawback of not going backwards on the chart but it can pause and go step by step forward only.
To overcome this problem, an analyst may have to use another approach to successful test strategy in visualization mode to debug and optimize the strategy to its best point
1. Step by Step on Time basis
Lets say you start optimization from 1,Aug,2024 You have only one option to move chart upto 2,Aug,2024 and then you can restart testing from EA Settings directly to 2,Aug,2024
If you have issues in between charts you may not able to continue from there as there is no option for going backward in strategy tester
2. Anlayse the Loss
An analyst should monitor losses and note the time during the test period of 1 day and try to comply if its happening according to the strategy or any other cause which needs to be fixed
Step 1 : If its ok as per strategy to have loss, ignore and continue to strategy tester
Step 2 : If its due to some error in code or another resolvable issue, Continue to fix your code and go back to step 1
It can be very time consuming to optimize a strategy to reduce bigger losses, but once done it can be highly rewarding for a trader.
Major keypoints on strategy during optimization
1. Any strategy in EA should have both buy sell conditions, netting or hedging mode compatibility and full testing for code errors
2. It should have Time control and time based expiry. Sometime market goes in consolidation mode, in such case your EA may see long waiting period with no buy sell, this can be solved with time based expiry
3. Any strategy should follow price action. It is MUST. There are some scenarios where price after confirming an entry keeps reversing opposite to the direction of Take Profit. In this case an analyst should develop a price action plan to exit a trade or cancel a pending order.
If you want to learn basics about how to buy sell
You should look at this code https://www.mql5.com/en/code/35391
It places trade using Trade.mqh in built library which is very good for beginners
It allows order placement, cancellation, pending, market and all type of orders
To get notification of your order events
you can use this Library https://www.mql5.com/en/code/24901
which is very good for notification purpose of trade events.
Here is one of example of my own strategy which has seen some unwanted losses, this can be fixed and strategy can be more optimzed by investing time on optimization