LouK: So my question is: Does each tick download account, as well as market, info? Is a check of OrdersTotal() for example, a local, and not a remote, check?
- Connection established Account history and current orders list sent
- Chart is opened, history refresh is requested. This is why after a disconnect/connect IndicatorCounted returns nonzero for a few ticks and then zero. History refresh arrives.
- Market change, update is sent and OnTick is called if not active.
- Order status changes, update is sent. OrdersTotal() is local but may change while in OnTick. This is why you must count down when: Loops and Closing or Deleting Orders - MQL4 forum
WHRoeder:
- Connection established Account history and current orders list sent
- Chart is opened, history refresh is requested. This is why after a disconnect/connect IndicatorCounted returns nonzero for a few ticks and then zero. History refresh arrives.
- Market change, update is sent and OnTick is called if not active.
- Order status changes, update is sent. OrdersTotal() is local but may change while in OnTick. This is why you must count down when: Loops and Closing or Deleting Orders - MQL4 forum
Thanks for the help!
I understand that the value of OrdersTotal() can change intra tick. I just want to be clear about #4:
Then a line like "int numTickets=OrdersTotal();" DOES NOT constitute an additional server query, it just retrieves the value of a local variable "OrdersTotal()", which was refreshed to the value which existed at the instant of the tick, correct?
Thanks again!
OrdersTotal() value doesn't change if there is no change in trade orders.
LouK: retrieves the value of a local variable "OrdersTotal()", which was refreshed to the value which existed at the instant of the tick, correct?
It retrieves the last value saved from the last update received. If an update is received while your OnTick is busy (server calls takes time seconds/minutes) the value changes between calls.
It is not the value at the beginning of the tick, it is the current value.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I want to be sure I understand how MT4 handles the forex servers.
I’ve been working with the assumption that there are market data servers which tick the EA and a broker server which I need to query separately for account information. I started cleaning up an EA to stop it from checking OrdersTotal() every tick, thinking that reduces server queries and lightens my communication load. But maybe this is not the case?
So my question is: Does each tick download account, as well as market, info? Is a check of OrdersTotal() for example, a local, and not a remote, check?
Thanks for your help.