simple script /ea for a ma crossover

Post Reply
numbat1
Posts: 6
Joined: Sat Jan 04, 2014 12:32 am

simple script /ea for a ma crossover

Post by numbat1 »

MIG Bank Trading Station.png
Hi everyone. One of the tools I use is the moving average. I know there is no wow factor in it and I have attached a pic. I was wondering if someone has a script or EA they could share or point me in the right direction. I am not technical otherwise I would have a go.

The concept is to issue a buy or sell when the first candle/bar closes either below or above a Moving average. I don't know how easy or difficult it is to add several more variables i.e

MA change shift etc, buy/sell switch on off, higher TF for trend direction ( no counter trend trades).

This is a 3 ma shifted 3 on 60 min tf.

Thanks in advance everyone
You do not have the required permissions to view the files attached to this post.
xtractalpha
Posts: 1
Joined: Thu Apr 03, 2014 12:13 pm

simple script /ea for a ma crossover

Post by xtractalpha »

Hi,

Maybe this will help you...

Code: Select all

void CheckForOpen()
   {
   double   ma;
   int      res;
   
   ////
   if(volume[0]>1)return(0);
   
   ma=iMA(NULL,0,MAP,MAS,MODE_SMA,PRICE_CLOSE,0);
   ////
   
  if(Close[2]<ma && Close[1]>ma)
      {
      res=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-Point*SL,Ask+Point*TP,NULL,123,0,Blue);
      return(0);
      }
   else if(Close[2]>ma && Close[1]<ma)
      {
      res=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid-Point*SL,Bid+Point*TP,NULL,123,0,Red);
      return(0);
      }
Post Reply

Return to “Coders Hangout”