Anyone create a 10/30 day sma EA? (new to the forum)

 
I'm looking for a 10/30 day Simple Moving Average cross to automatically buy and sell after the cross on the next time bar open. Has anyone written something similar or is there anyone that can write one for me? Just let me know what you charge for this service. Thanks so much!
 
jglasshof:
I'm looking for a 10/30 day Simple Moving Average cross to automatically buy and sell after the cross on the next time bar open. Has anyone written something similar or is there anyone that can write one for me? Just let me know what you charge for this service. Thanks so much!

Here you are:

//+------------------------------------------------------------------+
//|                                                       YourEA.mq4 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

int ticket;
extern double mylot=0.1;
extern int fastMA=10;
extern int slowMA=30;
extern int modeMA=MODE_SMA;
extern int priceMA=PRICE_CLOSE;
extern int sl_limit=50; 
extern int tp_limit=50; 

double ma1,ma2;
double ma3,ma4;
bool up_cross=false;
bool down_cross=false;



int start()
  {
//----

   ma1=iMA(NULL,0,fastMA,0,modeMA,priceMA,0);
   ma2=iMA(NULL,0,fastMA,0,modeMA,priceMA,1);
   ma3=iMA(NULL,0,slowMA,0,modeMA,priceMA,0);
   ma4=iMA(NULL,0,slowMA,0,modeMA,priceMA,1);
   
   
   
   if(ma1<ma3 && ma2>ma4) down_cross=true;
   else down_cross=false;
   if(ma1>ma3 && ma2<ma4) up_cross=true;
   else up_cross=false;
   
   
      
   if(OrdersTotal()==0 && down_cross==true && Volume[0]<=3) 
      {
      ticket=OrderSend(Symbol(),OP_SELL,mylot,Bid,3,Bid+sl_limit*Point,Bid-tp_limit*Point,"",0,0,Coral);
      }
   
   if(OrdersTotal()==0 && up_cross==true && Volume[0]<=3) 
      {
      ticket=OrderSend(Symbol(),OP_BUY,mylot,Ask,3,Ask-sl_limit*Point,Ask+tp_limit*Point,"",0,0,LawnGreen);  
      }
      
    
//----
   return(0);
  }
//+------------------------------------------------------------------+


You can set up the parameters. Try out this on demo, I didn't decompile it!!!

BTW: it's a very basic EA, not profitable.

Cheers

 
ggekko:

Here you are:


You can set up the parameters. Try out this on demo, I didn't decompile it!!!

BTW: it's a very basic EA, not profitable.

Cheers




What about an 8/ 20 period ma cross on an hourly chart?

 
b9213:


What about an 8/ 20 period ma cross on an hourly chart?


meaning has anyone tried this and can the above work for that?
 
you may check codelibrary and search for MA to find many examples