How can I trade Several Accounts or Several Crosses?

 
I I have two accounts , and would like to trade the same EA in both, What can I do?

and also If in each of those accounts I would like to trade say 4 currency crosses, each

example

Account 1
EA1 for EURUSD, and GBPUSD...
EA2 for CHFUSD
EA3 for JPYUSD

Account 2
same as Account 1
 
Slawa, can you please answer this?
 
i don't understand your problem. just do it
 
I I have two accounts , and would like to trade the same EA in both, What can I do?

and also If in each of those accounts I would like to trade say 4 currency crosses, each

example

Account 1
EA1 for EURUSD, and GBPUSD...
EA2 for CHFUSD
EA3 for JPYUSD

Account 2
same as Account 1


Ok you have two problems:

1. Trading with two accounts: It is not possible with one instance of Metatrader. I though have a setup here, where I trade with my live account in one instance and have a expert trading on a competition account. It is simply and quickly done: Install the first instance for example into \Programs\MT4A and the second into \Programs\MT4B.

This has one very serious pitfall: You can only start one version of the Metaeditor, you never know which one it is and you never know which sources you just edited.

It works for me still, since I have one trading PC, where I do not develop and all the development I do on another PC where I only have one version of MT

2. To have one Expert run for several currencies, you must first program the experts accordingly, that they are "blind" to trades for other currencies. I do that with the MagicNumber. My Scripts give a specific Number for each Currency and add that to a specific number for the script. It looks sort of like this:

MagicNumber = 3000 + func_Symbol2Val(Symbol())*100 + func_TimeFrame_Const2Val(Period()); 



while func_Symbol2Val and func_TimeFrame_Const2Val are external functions which give back a value of int according to the Symbol and according to the Period.

Than, with all modifications and closings I do not go through all trades on this account but only on trades with the regarding MagicNumber


   for(cnt=OrdersTotal();cnt=>0;cnt--)
   {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()==OP_BUY && OrderMagicNumber()==MagicNumber) {
   ....



et voila ... ca marche!

 
Thank you fukinagashi

Slawa, do you undertand the problem now?
 
magic number was introduced especially for orders recognition purposes and avoid conflicts
 
Btw, I'm doing something similar to this (but a little easier as the order recognizes it's symbol anyway via OrderSymbol()).

int MyMagic;

int init()
{
    MyMagic= 12345 + Period();  // each strategy gets it's own base number
}

......

   for(cnt=OrdersTotal();cnt=>0;cnt--)
   {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol()!=Symbol() || OrderMagicNumber()!=MyMagic) {
         continue;
      }
   ....




The problem with only being able to open one window per account would remain though.


Markus