Virtual Servers and Global Variables

 

I am interested in the new virtual server but have a problem with the global variable statement saying that they will not work.

My current MT4 EA uses "TradeBusy", "TradeNotBusy" global variable to prevent problems with opening/closing trades.

How can I get around the problem to ensure I do not miss trades opening or closing or getting errors trying to trade when the server is already busy with another trade.

 
BigAl:

I am interested in the new virtual server but have a problem with the global variable statement saying that they will not work.

My current MT4 EA uses "TradeBusy", "TradeNotBusy" global variable to prevent problems with opening/closing trades.

How can I get around the problem to ensure I do not miss trades opening or closing or getting errors trying to trade when the server is already busy with another trade.

Sorry, maybe I've misunderstood your logic, but why use a global instead of the built in function IsTradeContextBusy() ?
 
Stuart Browne:
Sorry, maybe I've misunderstood your logic, but why use a global instead of the built in function IsTradeContextBusy() ?

When using multiple symbol pairs and multiple charts it is possible that two executing EAs and/or two or more charts may contend for service at the same time causing trades to be missed or not closed etc.

Error 146 ("Trade context busy") and How to Deal with It

I therefore use a global variable to to control the possible conflictions for all currently executing EAs

Reason: