Remove EA from Chart if runing on 2 or more. Charts

 
Good day. 

I am two instances of the same EA runing. 
So this EA, opens an order if previous order on the symbol was a loss. And you have just manually opened a new order making the total orders 2. 

So if i have 2 instances say on chart 1. Usdjpy chart 2 gbpusd both have EA attached 
Then on chart 3 Audjpy is what im trading. 

Then i place order both EAs open the same order. 
Even though i have 
Order check based on 
1. Magic 
2. Comment (each recovery order has ticket of the loosing Order in comment) 



My question is if tge same EA is running on 2 charts can 1 be paused. 
Is there a way to checkifh eame EA is running on more than 1 chart then number the charts based on how they apear in the chart tabs bottom screen then ExpertRemove the rest to stay with 1
 
  1. Jefferson Metha: So if i have 2 instances say on chart 1.
    That is impossible. Only one EA per chart.

  2. Jefferson Metha 2. Comment (each recovery order has ticket of the loosing Order in comment)
    Not a good idea to use comments, brokers can change comments, including complete replacement.

  3. Jefferson Metha: Then i place order both EAs open the same order. 
    Code your EA to only trade the current symbol. Then put it on multiple charts. Done.
    Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
              Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
              PositionClose is not working - MQL5 programming forum
              MagicNumber: "Magic" Identifier of the Order - MQL4 Articles

  4. Code your EA to trade all wanted symbols and only put it on one chart.
    1. You can't use any {MT4: predefined variables, MT5: predefined variables,
    2. Must poll (not OnTick, unless you use specific indicators)
                The Implementation of a Multi-currency Mode in MetaTrader 5 - MQL5 Articles
    3. and usually other problems, e.g. A problem with iBarShift - MQL4 programming forum - Page 2
    4. You must handle History {MT4:4066/4073 errors: Download history in MQL4 EA - MQL4 programming forum, MT5: Timeseries and Indicators Access /  Data Access - Reference on algorithmic/automated trading language for MetaTrader 5.}

  5. Jefferson Metha: Is there a way to checkifh eame EA is running on more than 1 chart
    Just typed. Not compiled, not tested.
    #include "mutex.mqh"
    string activeGVN; uint activeTC;
    int OnInit(){
      Mutex m; m.lock();
        activeGVN = WindowExpertName() +"_active";
        activeTC  = GetTickCount();
        GlobalVariableSet(activeGVN, activeTC);
        Sleep(10);
      // Auto unlock at end
      ⋮
    }
    void OnTick(){
      if (GlobalVariableGet(activeGVN) != activeTC){ Alert(…); activeGVN=""; ExpertRemove(); return; }
      ⋮
    }
    void OnDeInit(){
      GlobalVariableDel(activeGVN):
      ⋮
    }
    Just typed. Not compiled, not tested.
              See my Mutex: Prevent EA from opening trades at the same time across two or more pairs? (Steve) - MQL4 programming forum 2016.06.21
 
William RoederThat is impossible. Only one EA per chart.

I meant 1 symbol 2 charts. sorry about that.

William RoederNot a good idea to use comments, brokers can change comments, including complete replacement

this is New to me, Thanks.

William RoederCode your EA to only trade the current symbol. Then put it on multiple charts. Done.

ok, thanks I am Using Unique Magic Numbers was trying to have a one size fits all type of scinerio

William Roeder:

  1. Just typed. Not compiled, not tested. Just typed. Not compiled, not tested.
              See my Mutex: Prevent EA from opening trades at the same time across two or more pairs? (Steve) - MQL4 programming forum 2016.06.21

thank You yes. this is what I am looking for. 

Thanks Mate

Reason: