This is my first time coding in MQL4
I’m not sure what the error is, I was following a video of youtube, and it seems my code has multiple errors even though it was the same, could this be because it was an old video and mql4 language updated?
Here is the code below
//+------------------------------------------------------------------+
//| UntitledEMAX.mq4 |
//| Mark Flint Pillay |
//| https://www.eidoyada.com |
//+------------------------------------------------------------------+
#property copyright "Mark Flint Pillay"
#property link "https://www.eidoyada.com"
#property version "1.00"
#property strict
extern int MagicNumber=12345;
extern int TakeProfit=50;
extern int StopLoss=25;
extern double LotSize=0.01;
extern int FastMA=5;
extern int FastMaShift=0;
extern int FastMaMethod=0;
extern int FastMaAppliedTo=0;
extern int SlowMA=21;
extern int SlowMaShift=0;
extern int SlowMaMethod=0;
extern int SlowMaAppliedTo=0
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit();
{
//---
double ticksize = MarketInfo(Symbol(), MODE_TICKSIZE);
if(ticksize == 0.00001 || ticksize == 0.001);
double pips = ticksize*10;
else pips =ticksize;
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick();
{
//---
double CurrentFast = iMA (NULL,0,FastMA,FastMaShift,FastMaMethod,FastMaAppliedTo,1);
double PreviousFast = iMA (NULL,0,FastMA,FastMaShift,FastMaMethod,FastMaAppliedTo,2);
double CurrentSlow = iMA (NULL,0,SlowMA,SlowMaShift,SlowMaMethod,SlowMaAppliedTo,1);
double PreviousSlow = iMA (NULL,0,SlowMA,SlowMaShift,SlowMaMethod,SlowMaAppliedTo,2);
// if statement - Logic Comes Here
if(PreviousFast<PreviousSlow && CurrentFast>CurrentSlow)
if(OrdersTotal()==0)
OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,Ask-(StopLoss*pips),Ask+(TakeProfit*pips),NULL,MagicNumber,0,Green);
if(PreviousFast>PreviousSlow && CurrentFast<CurrentSlow)
if(OrdersTotal()==0)
OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,Bid+(StopLoss*pips),Bid+(TakeProfit*pips),NULL,MagicNumber,0,Red);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+