SMA Trading Bot

 

Im just starting to write my first Trading Bot and following this guys example on Youtube :

https://www.youtube.com/watch?v=H-PvwiHVO34&t=0s&list=WL&index=95

But hes using MQL5 and I only have MQL4 and MQL4 which doesnt have CopyBuffer

Is there anyway around this ? 

What I have so far :


void OnTick()

  {

      // create an Array for several prices

      double myMovingAverageArray[];

  

      // define the properties of the Moving Average

      int movingAverageDefinition =iMA (_Symbol,_Period,20,0,MODE_SMA,PRICE_CLOSE);

      

      // sort the price array from the current candle downwards

      ArraySetAsSeries(myMovingAverageArray,true);

      

      // Defined EA, one line,current candle,3 candles, store result

      CopyBuffer(movingAverageDefinition,0,0,3,myMovingAverageArray); 

       

      // calculate EA for the current candle

      double myMovingAverageArray=myMovingAverageArray[0];

      

       // Chart output of the current EA

      Comment ("MovingAverageValue: ",myMovingAverageValue);     

          

  

  }   




 
please read iMA documentation (MQL4)
 
Otherwise I might stick to the MQL4 examples the Youtube guy gives which will make learning intially easier
 
Fred7777:
Otherwise I might stick to the MQL4 examples the Youtube guy gives which will make learning intially easier
mql 5 and 4 are different, few similarities . if u want to write in mql4 avoid watching mql5 video
 
Samuel Akinbowale:
mql 5 and 4 are different, few similarities . if u want to write in mql4 avoid watching mql5 video

Lol - very true