Need coding help with magic number

 

Hi guys,

I want to let the 2 EAs run on one account but if there is one buy and one sell position of the London_Open EA open the NY_Open EA can´t open a buy and a sell position. Each EA should open one buy and one sell position at givin time.


Who can help?


Regards,

Files:
 
read more on OrderSend()

check in codebase, it might give you some ideas
 

use a different magic no.

 
jimbofx7:

Hi guys,

I want to let the 2 EAs run on one account but if there is one buy and one sell position of the London_Open EA open the NY_Open EA can´t open a buy and a sell position. Each EA should open one buy and one sell position at givin time.


Who can help?


Regards,


I've added Magic Number coding. If you like it, send me the proceeds of your best trade this month :)
Files:
ny_openv1.mq4  4 kb
 
serpentsnoir:

I've added Magic Number coding. If you like it, send me the proceeds of your best trade this month :)
Thanks a lot ! :-)
 
  1. As I pointed out here
       if(Digits==3 || Digits==5)
         {
          dXPoint=10;
          int SLIPPAGE=SLIPPAGE*dXPoint;
         }
    
    will not work, each refresh, EA parameter change, TF change, or pair change will multiple SLIPPAGE 10x, 100x, 1000x...
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){
        if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    

  2.    if(
          (OrderType()!=OP_BUY && b_cnt==0)
    
    This code is outside the orderSelect loop, there is no reason to assume the OrderType() is refering to your order or ANY order.
  3. On ECN brokers you must orderSend and THEN set the tp/sl.
Reason: