How to restrict the EA to run with only one symbol, avoiding its accidental running with other symbols?

 

I need run a certain modules of an EA to be run with only one symbol, let say "EURUSD" and block others (GBPUSD) to do the same.

For ex, if my robot is used in one symbol (EURUSD), and if it is runnig some module of closing all orders, I need to block other symbols to do the same. 

That means, for example, if the robot is also used with any other symbol, like GBPUSD, the same module should not work there... How to do this?

Because, it is usulally initiated by some event and I cannot block it.

Any idea?


Regards

Bahman

 
bahmanasgerov:

I need run a certain modules of an EA to be run with only one symbol, let say "EURUSD" and block others (GBPUSD) to do the same.

For ex, if my robot is used in one symbol (EURUSD), and if it is runnig some module of closing all orders, I need to block other symbols to do the same. 

That means, for example, if the robot is also used with any other symbol, like GBPUSD, the same module should not work there... How to do this?

Because, it is usulally initiated by some event and I cannot block it.

Any idea?


Regards

Bahman

Maybe Global Variables or CSV files could be used to control events of the same EA copies on the different symbol charts... I will give a try to this to see if I can block other symbols event processing if it is done recently...

 
bahmanasgerov #:

Maybe Global Variables or CSV files could be used to control events of the same EA copies on the different symbol charts... I will give a try to this to see if I can block other symbols event processing if it is done recently...

It was a bit complicated with Global Variables, so I have decided to use som CSV file to allocate time of access to some orders module and it can be used as a common data...

Here is the code:

-----------------

datetime Global(int mode) {fil=FileIsExist("Global.csv");foo=FileOpen("Global.csv",FILE_READ|FILE_WRITE|FILE_CSV);

if (!fil&&mode==1) FileWriteString(foo,TimeToStr(TimeLocal())); else datetime dt0=FileReadDatetime(foo);FileClose(foo);return dt0;}

------------------


Now it looks ok, thanks a lot to anyone who is interested in this issue.

Regards

Bahman