stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

simple script /ea for a ma crossover
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3887
Page 1 of 1
Author:  numbat1 [ Mon Oct 20, 2014 1:00 am ]
Post subject:  simple script /ea for a ma crossover

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
Author:  xtractalpha [ Sat Dec 20, 2014 6:09 pm ]
Post subject:  simple script /ea for a ma crossover

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);
      }
All times are UTC Page 1 of 1