Hi experts, what is your opinion about this solution?
Of course. This is a total close all.
Sometimes there are situations (for example you want to close too many open trades immediately) when the "original" version doesn't work. This version is good for this.
I have a question about while loops. I want to run the current EA on a loop as frequent as possible. So, my thought is to put the current code inside a while loop with a sleep function included inside that causes the while to only execute every 1 millisecond.
However, when I did this, (I have some Print("...") function calls put in which keeps track of what's happening on each loop), I see this freezing, and no more prints to the screen.
I'm wondering what the problem might be. Is it ok to run the EA on a loop as frequent as 1ms? Would there be an issue with trying to obtain the latest bid/ask for example from the server every millisecond? Would this put too much load there, causing the freeze?
Possibly something else my algorithm is doing is causing this, I'm not sure.
I have ran it on 200ms cycles and still get the same problem (though just not as immediate). Could there be an issue with printing too many lines to the log file?
thanks for any advice on this.
I have a question about while loops. I want to run the current EA on a loop as frequent as possible.
So, my thought is to put the current code inside a while loop with a sleep function included inside that causes the while to only execute every 1 millisecond.
Would there be an issue with trying to obtain the latest bid/ask.
Could there be an issue with printing too many lines to the log file?
Turns out, the problem I had was not due to encapsulating my EA code inside a while loop with a 1ms sleep. This part seems fine (regardless of where I print to screen or not) as I have it running now for the last half hour without fault.
The problem was due to another sneaky while I had in the code which eventually caused the EA to get trapped in an infinite loop.
Thanks for the input gooly and Roesder.
Hello everybody. I read this topic and I have question. I try to make a code, which delete pending order (only STOP, no LIMIT), but only if another pending order was activated (start be OP_SELL or OP_BUY). So code is this (but there are a mistakes, but I don´t know where). Could you look at my code please?
int i, j, cmd, cmd2,total;
for(i=0; i<total; i++)
if(cmd!=OP_BUYSTOP && cmd!=OP_SELLSTOP) //take an orders which was activated
for(j=0; j<total; j++) //another variable j
if(cmd2!=OP_BUY && cmd2!=OP_SELL)
result=OrderDelete(OrderTicket()); //first pending order become to OP_SELL or OP_BUY, second pending order will be delete
if(result!=TRUE) Print("LastError = ", GetLastError());