Since you are using a multithreaded approach in an preemptive environment, you will need to do the synchronisation of your processes yourself inside the code.
You need some sync object to know in which state the objects are.
A possible way could be terminal global variables.
Or a check of the content of the buffers values of each indicator.
Dominik Egert #:
Since you are using a multithreaded approach in an preemptive environment, you will need to do the synchronisation of your processes yourself inside the code.
You need some sync object to know in which state the objects are.
A possible way could be terminal global variables.
Or a check of the content of the buffers values of each indicator.
I do not know if I understood your suggestion very well for using terminal global variables. Would I have one global variable by indicator to indicate the last processed candle? If the suggestion is this, I think it could work. But the implementation would be pretty ugly.
Thinking about this approach would not have a form for the functions of MQL5 to identify the last calculated candle?
If you do not have, with this last segester you gave, would you create a new buffer containing the times of the candles?
David Guerra #:
I do not know if I understood your suggestion very well for using terminal global variables. Would I have one global variable by indicator to indicate the last processed candle? If the suggestion is this, I think it could work. But the implementation would be pretty ugly.
Thinking about this approach would not have a form for the functions of MQL5 to identify the last calculated candle?
If you do not have, with this last segester you gave, would you create a new buffer containing the times of the candles?
I think she is suggesting that you should use a (Semaphore, mutex, events or something like that) ... they are syncing tools for concurrent processes (threads).
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
Hi,
I created an indicator calling another internally indicator. They are called using the iCustom function. If I call with the visual mode enabled, the "OnCalculate" function of the outermost indicator is called first. If I call with the visual mode disabled, the order is reversed.
To explain better, follow the code of the file "Test.mq5":
And below the source code of "TestWrapper.mq5":
And, lastly, the file code of EA "TestEA.mq5":
Follow the execution log with Visual Mode Disabled (as expected):
Follow the execution log with Visual Mode Enabled:
See that in execution with visual mode enabled, considering the same time in the two executions (9:10:00), running with the visual mode enabled performs the main indicator, "TestWrapper", before running the internal indicator "Test", this generates distortions between backtest results by enabling visual mode or not.
Do you have a way to force the code that the "OnCalculate" method of the "Test" indicator be executed before the "TestWrapper"? Can you specify an order of precedence between the indicators? I wanted the behavior verified in the mode without the visual mode to be the same using visual mode enabled.