Why i cannot open an EA's properties after some time

 

Hi guys,

i am encountering some issues here which i have no idea how to solve by myself. The situation is:

1. i have 10 same EA loaded on 10 different pair charts.

2. after some time, i cannot open some charts' EA properties by clicking the smiling face OR pressing F7. It is like hanging at there, and the EA on the chart wasnt taking any trade even though EA was suppose to take the trade.

What i am suspecting is that it could be caused by 'while' and 'for' loop. Could this be possible? anyone encountering this issue also where after a certain of time, u cannot open the EA properties where u have to remove the ea and load it again to the chart to open the properties dialog.

Below is the while and for loop that i wrote in the EA:

while (!IsOpened) { // ver 1.2
ticket = OrderSend(Symbol(), OP_SELL, volume, Bid, slippage, sll, tpl, "", Magic, 0, Red);

if (ticket > 0) IsOpened = true;
}

===================================================================

for (int i = 0; i < OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS)) //
if (OrderSymbol() == Symbol()) { //
ticket = OrderTicket(); //
IsDetected = true; //
if (OrderType() == OP_BUY) IsBuy = true; //
if (OrderType() == OP_SELL)IsSell = true; //
break; //
} //
} //

=========================================================================

while (!IsClose)
IsClose = OrderClose(ticket, volume, Ask, 3, Blue);

==========================================================================

Could it be the logic above caused the failure of opening the properties dialog box and not execute any trade?

 

H

If the EA is 'busy', i.e. processing code after a tick, the properties will not open

Also, its likely the multiple EA copies in one instance of MT are queuing for the 'order channel' and delaying each other

I suggest you change your logic to save the last ordered time and every minute or so, check if it is still open

This will make backtesting faster and give your CPU a break during live trading

-BB-

 
BarrowBoy:

Also, its likely the multiple EA copies in one instance of MT are queuing for the 'order channel' and delaying each other

I suggest you change your logic to save the last ordered time and every minute or so, check if it is still open

Thanks for your advice, can you please explain in details about the 'order channel' thing? i think my problem is there, will try to edit my logic flow. Sry, i am new to MT4.