
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
Then OnTesterPass() is being called BEFORE any OnTick events, just as I suspected, so you will not be able to collect data about the Test Date Range this way.
You may need to use the OnTester() instead, but you will need to output to a File as it seems that you cannot Print() from OnTester() either.
Do you mean I need to output to a File using FrameAdd()?
Then OnTesterPass() is being called BEFORE any OnTick events, just as I suspected, so you will not be able to collect data about the Test Date Range this way.
You may need to use the OnTester() instead, but you will need to output to a File as it seems that you cannot Print() from OnTester() either.
actaually onTick() works well with OnTesterPass() because I am able to extract AccountInfoDouble(ACCOUNT_BALANCE) and pass it into array using FrameAdd
But is it returning the final balance or initial balance?
Ignore my suggestion. I forgot the Print() is not your objective but the actual data about the time.
Just last question, does TimeCurrent() works as usual in onTick() during optimisation? Thanks for help
Yes it does! However, you did not answer my other question which will be relevant ...
actaually onTick() works well with OnTesterPass() because I am able to extract AccountInfoDouble(ACCOUNT_BALANCE) and pass it into array using FrameAdd
But is it returning the final balance or initial balance?
No, I meant what value does it return in OnTesterPass()?
That is the whole point, to now if OnTesterPass() is being called before OnTick() is ever called or at the end of the test.
No, I meant what value does it return in OnTesterPass()?
That is the whole point, to now if OnTesterPass() is being called before OnTick() is ever called or at the end of the test.
OnTesterPass() is called AFTER any EA standard events, at the end of a pass.
The problem was there is no direct communication between the tested EA and OnTesterPass(), you need to transmit the value(s).
Imagine a cloud optimization, each pass of the tested EA is run remotely. It uses the standard EA events (OnInit, OnTick...), including OnTester().
At the same time, you have a special instance of the EA, running locally on your MT5 platform, which works ONLY with OnTesterInit(), OnTesterDeInit() and OnTesterPass() ( (when these events() are used otherwise this special instance is not launched).
Remotely, at the end of a pass, within OnTester() you can calculate and/or send data using FrameAdd(). These data will be received by the local instance with OnTesterPass(), there you can extract the data and process them.
Begin...
OnTesterPasspass: 1 2023.02.03 23:54:59
OnTesterPasspass: 0 2023.02.03 23:54:59
OnTesterPasspass: 2 2023.02.03 23:54:59
OnTesterPasspass: 3 2023.02.03 23:54:59
OnTesterPasspass: 4 2023.02.03 23:54:59
OnTesterPasspass: 5 2023.02.03 23:54:59
... end.
That being said, I don't see any interest to transmit TimeCurrent(), it will be the same on all passes, but that's a detail.