Highest OrdersTotal
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
MaxOpenOrders = 0; Move this line to OnInit so it executes only once.
Actually he needs to move it outside of any function scope (so it will be global variable).
If he'll move it to OnInit(), the above variable will only reside within OnInit() scope.
But you can also just change it to a static variable.
Simply change code to-
static int MaxOpenOrders = 0;
static int MaxOpenOrders = 0;
That will not work on a symbol (chart) change; EAs are not reloaded.
Resetting static: Problem in detecting a new Bar - MQL5 programming forum #5.3 (2020)
Thx a lot for your help guys
I moved it to a global variable and it works perfectly.
Hi all,
Trying to find the highest amount of open orders but but this code gives the same amount for TotalOpenOrders and MaxOpenOrders.
Thx a lot.
Amir