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

To add comments, please log in or register
sadeth06
65
sadeth06  

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
Keith Watford
Moderator
20477
Keith Watford  
int counted_bars=IndicatorCounted(); 

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

sadeth06
65
sadeth06  
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>
Keith Watford
Moderator
20477
Keith Watford  
   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.

sadeth06
65
sadeth06  
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:
To add comments, please log in or register