Can Any One Help Me With this 3 MA Crossover EA?

 

HI can some one fix this EA its not opening any orders. EA MQL4 Scrip is attached bellow

please help me with the code

strategies i copied from indicator i want to send buy orders when new signal comes. 


I have a equation too in mql4 can i do this?

int start()

 for(int cnt=0; cnt<OrdersTotal(); cnt++)

     {Some Script }

can i add another for like this?

int i,counter;

   int counted_bars=IndicatorCounted();   if(counted_bars<0) return(-1);   if(counted_bars>0) counted_bars--;   int limit=Bars-counted_bars; if(counted_bars==0) limit-=1+9;


   for(i=0; i<=limit; i++)

     {Some Script }


Thank You Guys....

Files:
3EA.mq4  21 kb
 
int counted_bars=IndicatorCounted(); 

this is code used in an indicator, not an EA.

 
Keith Watford:

this is code used in an indicator, not an EA.

Oh Thanks,

Can you help me to Fix this Ea?

i have set it to cci = 200 buy and -200 sell 

but its continuously opening orders how to stop that or give this a time to next order? 

<incorrect attachment deleted>
 
   OrderBuy=0;
   OrderSell=0;
   for(int cnt=0; cnt<OrdersTotal(); cnt++)
     {
      if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && OrderComment()==Comment)
           {
            if(OrderType()==OP_BUY) OrderBuy++;
            if(OrderType()==OP_SELL) OrderSell++;
           }
     }

  
   double M_A=iMA(NULL,0,Moving_Avarage,0,MODE_EMA,PRICE_CLOSE,0);
   double rsi=iRSI(Symbol(),0,RSIperiod,PRICE_CLOSE,0);
              

//open position
   if(OrderSell<MAX_ODERS && rsi<SellLevel && Close[1]>= Open[0] && Open[1]> Open[0] && Open[0]) OPSELL();
   if(OrderBuy<MAX_ODERS && rsi>BuyLevel && Close[1]<= Open[0] && Open[1]> Open[0] && Open[0]) OPBUY();

Not a good idea to use OrderComment() in your code as this can be changed by your broker.

I don't see that it will continuously open trades as you have  maximum set.

i have set it to cci = 200 buy and -200 sel

There is no cci used in the code, so I think that you have attached the wrong code.

 
Keith Watford:

Not a good idea to use OrderComment() in your code as this can be changed by your broker.

I don't see that it will continuously open trades as you have  maximum set.

i have set it to cci = 200 buy and -200 sel

There is no cci used in the code, so I think that you have attached the wrong code.

I found the Correct File. That was not the right one so sorry.

And thank you for replying me.

Correct one is attached here 

Files: