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
This is about the same reason I need it. I already parse the xml and html reports. However, now I need to store the results in a sqllite database, which content is read by an external program.
So, the only way I can think of to solve this is to construct a custom identifying unique value yourself. For example a string with your parameter names and values, or a hash. When you store it in json format, you can interpret the identifier in external programs.
And remember that you keep it's signature consistent and normalize the parameter values, their order and number of parameters. Because "{inp_myParamx = 0.0, inp_myParamy = "value"}" is not the same as "{inp_myParamx = 0.000, inp_myParamy = "value"}" or "{inp_myParamy = "value", inp_myParamx = 0.000, inp_myParamz = -1}" .
I stand corrected. As it turns out, in the OnTester() you a remote agent can not write to db or file. That makes sense, because where would it write to for a remote agent and how to retrieve that data then?
So you have to use frames, which include parameters and the pass for identifying an optimization pass.
The concept is actually not so difficult. With frameadd, you can "send" a value or an array of values to the main, local terminal. Send it from OnTester().
In the OnTesterPass() you can catch the sent frame with FrameNext, which contains that pass# and your array. With FrameInput you get all parameters and values of that pass.
That's it.
I stand corrected. As it turns out, in the OnTester() you a remote agent can not write to db or file. That makes sense, because where would it write to for a remote agent and how to retrieve that data then?
So you have to use frames, which include parameters and the pass for identifying an optimization pass.
The concept is actually not so difficult. With frameadd, you can "send" a value or an array of values to the main, local terminal. Send it from OnTester().
In the OnTesterPass() you can catch the sent frame with FrameNext, which contains that pass# and your array. With FrameInput you get all parameters and values of that pass.
That's it.
You can send a lot more than a value or an array.
https://www.mql5.com/en/forum/165457#comment_5077892
You can send a lot more than a value or an array.
https://www.mql5.com/en/forum/165457#comment_5077892
Great! That should satisfy most requirements when dealing with remote agents and their results. (I've also tested it with structs (classes not yet), also works.)
There are two very important additions I like to add. It addresses the following quote from the manual:
OnTesterDeinit - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Keep in mind that optimization frames sent by test agents using the FrameAdd() function may come in bundles and take time to deliver. Therefore, not all frames, as well as TesterPass events, may arrive and be processed in OnTesterPass() before the end of optimization. If you want to receive all belated frames in OnTesterDeinit(), place the code block using the FrameNext() function.
1) When storing data in files or sqlite, do not proces frames in OnTesterPass() but in OnTesterDeinit(). OnTesterPass() quite often ends when there are still frames to be received.
2) OnTesterDeinit() does this too but that's why you have to create a process that processes all frames until none left.
Another reason why you should place it in OnTesterDeinit() is that OnTesterPass() can fire multiple time (for each frame received) and OnTesterDeinit() only once. If you create the loop in OnTesterPass() the loop will fire as much as there are OnTesterPass() events, which creates unnecessary performance impact, locking etc.
The following code has been tested and gives me continuous stable results, meaning no skipped or non-processed frames. The for loop ensures that exactly x frames are processed, where x = number of passes. The number of passes can be calculated with ParameterGetRange().