I am running EA on my home computer, everytime when I hear the heavy fan sound from the computer, I am worry about its health.
Is there anyway can improve the EA efficiency?
original code:
for(int i=0; i<OrdersTotal(); i++)
I am using below, instead of call OrderTotal() for each i.
int _ordertotal=OrdersTotal();
for(int i=0; i<_ordertotal; i++){
My intention is to reduce the procedure for the EA to call server, will this help to improve the efficiency and stability of EA?
I think there is no measurable difference in CPU use for the code you posted.
By chance, is you computer a laptop?
I think there is no measurable difference in CPU use for the code you posted.
By chance, is you computer a laptop?
Yes, i use laptop. I feel the bottle neck is the connection between computer and server. That is why unless use broker’s VPS, other vendor cannot improve at all.
It is expected the laptop cpu fan to spin up as soon as there is an increase in CPU load. This is totally normal because the fan is usually off at idle.
OrdersTotal() does not connect to the server.
As far I understand, Metatrader only connects to the server when using OrderSend(), OrderModify(), OrderClose() and OrderDelete(). If there is a big connection delay between your metatrader and the server you should see errors like trade context busy or requotes.
Good point!
If you don't need every tick for your strategy, then definitely skip the ones you don't need.
For example, some strategies only enter or exit at the beginning of a new bar. If this works for you, there are plenty of posts about detecting the start of a bar on this forum.
If you don't need every tick for your strategy, then definitely skip the ones you don't need.
For example, some strategies only enter or exit at the beginning of a new bar. If this works for you, there are plenty of posts about detecting the start of a bar on this forum.
Thank you for your reply.
That good point. Most of my orders are actually pending orders, all prices are pre-calculated grid, surround the current price, the initial purpose was to minimize the OrderSend() error and slippage. hence I don't need every tick.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am running EA on my home computer, everytime when I hear the heavy fan sound from the computer, I am worry about its health.
Is there anyway can improve the EA efficiency?
original code:
for(int i=0; i<OrdersTotal(); i++)
I am using below, instead of call OrderTotal() for each i.
int _ordertotal=OrdersTotal();
for(int i=0; i<_ordertotal; i++){
My intention is to reduce the procedure for the EA to call server, will this help to improve the efficiency and stability of EA?