Take one trade at a time EA

 

Hi guys. I would like to ask a small favour. This EA has multiple trades open at the same time (not sure what the developer did). Can I ask if you guys can put a parameter that only allows one trade open at a time? I have attached the EA.


Thanks for any sort of help.

Files:
Bimodal.mq4  4 kb
Bimodal.ex4  9 kb
 
Ask the developer.
 
Marco vd Heijden:
Ask the developer.

The EA was done a long time a go and the developer does not respond. I'm sure it is not hard I just don't know any mq4 code, I only know python otherwise I would have done it myself duh.

 
darkpoet:

The EA was done a long time a go and the developer does not respond. I'm sure it is not hard I just don't know any mq4 code, I only know python otherwise I would have done it myself duh.

 

void OnTick()
  {
   int nb_buy = count_order(0);
  
   if( nb_buy == 0)
    {
    if(RandomMODE==true)
      {
      if(CalculateRandom()==0 )
      {
      int tic_buy = OrderSend(Symbol(),OP_BUY,lot,Ask,4,(Ask-stoploss),(Ask+takeprofit),NULL,0,0,clrDeepPink);
      }
     }
    else if(StandardMODE==true)
     {
      double sar1;
      sar1=iSAR(Symbol(),0,0.02,0.2,0);
      if(Close[0]<sar1)
        {
         int tic = OrderSend(Symbol(),OP_BUY,lot,Ask,4,(Ask-stoploss),(Ask+takeprofit),NULL,0,0,clrDeepPink);
        }
     }
  }
  }


int count_order(int ord = -1 )
 {
  int nb_ord = 0;
   for( int i=(OrdersTotal()-1);i>=0;i-- )
      {
         if( OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false ) continue;    // Âûáèðàåì îðäåð
         if( OrderSymbol()==Symbol() )
           {
           if( OrderType() == OP_BUY && ord == 0  )
             {
             nb_ord ++;
     }}}        

  return( nb_ord );
 }
 
Here you go another variant. 
Also your EA trade only BUY orders.
Files:
Bimodal.mq4  4 kb
 
Hi,I deposited money but it's not reflecting in my account
Reason: