Good morning
In the doc, it is not specifically said that oncalculate is asynchronous.
It is said that the event is launched at each tick
Am I correct in thinking that the instructions in oncalculate are synchronous and each tick launches a new instance of oncalculate?
Instances of Oncalculate launch without waiting for the previous one(s) to complete?
I have been researching a similar topic; finding arguments for OrderSend and AsyncOrderSend, that I think is applicable to your question, but the answer is highly debated in threads and posts from several years "back".
The short answer, i think, is yes and no (not funny i know!).
From what i read, your comments are all correct: the function is synchronous, however, the deals, and communications with broker, are asynch. So, these functions are both neither and both.
The question you or we need to ask is if the command or instruction we want to use is synchronous or asynchronous, not if the whole function is or isnt.
I have been researching a similar topic; finding arguments for OrderSend and AsyncOrderSend, that I think is applicable to your question, but the answer is highly debated in threads and posts from several years "back".
The short answer, i think, is yes and no (not funny i know!).
From what i read, your comments are all correct: the function is synchronous, however, the deals, and communications with broker, are asynch. So, these functions are both neither and both.
The question you or we need to ask is if the command or instruction we want to use is synchronous or asynchronous, not if the whole function is or isnt.
I think that in fact it is all oncalculate which is the thread whose lines of code are synchronous, knowing that these lines of code can launch functions which can be by nature asynchronous, that is to say that a one more thread will be launched.
I think that in fact it is all oncalculate which is the thread whose lines of code are synchronous, knowing that these lines of code can launch functions which can be by nature asynchronous, that is to say that a one more thread will be launched.
i think you simplified everything i read over 3 hours, all in 1 sentence haha.
Short answer. All Indicators of a symbol runs in a single thread, and each tick in OnCalculate is processed one after another. As well any functions like OnChartEvent, OnBookEvent, etc. They are all executed one after another, not simultaneouly.
![Documentation on MQL5: MQL5 programs / Program Running Documentation on MQL5: MQL5 programs / Program Running](https://c.mql5.com/36/82/documentation-on-mql5-mql5-programs.png)
- www.mql5.com
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good morning
In the doc, it is not specifically said that oncalculate is asynchronous.
It is said that the event is launched at each tick
Am I correct in thinking that the instructions in oncalculate are synchronous and each tick launches a new instance of oncalculate?
Instances of Oncalculate launch without waiting for the previous one(s) to complete?