Simple Indicator change from Mql4 to Mql5

 

Hello,


I have been trying to convert the below code from mql4 to mql5 but am getting errors. I am new to this and would appreciate if any experienced programmer can help.


The code was originally written in mql4 and the purpose is quite simple i.e. to start labeling with each click. (1) , (2),.. (5). 


I have two errors 


1. 'ObjectCreate' - wrong parameters count

2. 'ObjectSetText' - function not defined






=============================

#property copyright "ABC"


#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Blue





string indicatorname = "EW_Labels";


input int num_labels = 5;

input string text_list = "(1),(2),(3),(4),(5)";

input string object_name = "label";

input int FontSize =12;

input string Face  ="Times New Roman";

input color Color = Blue;


string text_list_arr[];

int current_obj = 0;


void OnChartEvent(const int id,         // Event ID

                  const long& lparam,   // Parameter of type long event

                  const double& dparam, // Parameter of type double event

                  const string& sparam  // Parameter of type string events

                  )

{

   if (id == CHARTEVENT_CLICK) { 

      datetime time;

      double price;  

      int subwin;

      ChartXYToTimePrice(ChartID(),lparam,dparam,subwin,time,price);     

      string name = object_name+current_obj+time+price; 

      ObjectCreate(name, OBJ_TEXT, 0, time, price);

      ObjectSetText(name, text_list_arr[current_obj], FontSize,Face,Color);

      current_obj++;

      if (current_obj >= num_labels) ChartIndicatorDelete(ChartID(),0,indicatorname);

   }

}


int OnInit()

{

  //:::::::::::::::::::::::::::::::::::::::::::::

  double Ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);

  double Bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);

  int Bars=Bars(Symbol(),PERIOD_CURRENT);

  double Point=Point();

  //Etc.

  //:::::::::::::::::::::::::::::::::::::::::::::::


 

   return(0);

}


int OnDeinit()

{

  //:::::::::::::::::::::::::::::::::::::::::::::

  double Ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);

  double Bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);

  int Bars=Bars(Symbol(),PERIOD_CURRENT);

  double Point=Point();

  //Etc.

  //:::::::::::::::::::::::::::::::::::::::::::::::


   return(0);

}


int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime& time[],

                const double& open[],

                const double& high[],

                const double& low[],

                const double& close[],

                const long& tick_volume[],

                const long& volume[],

                const int& spread[])

{

  //:::::::::::::::::::::::::::::::::::::::::::::

  double Ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);

  double Bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);

  int Bars=Bars(Symbol(),PERIOD_CURRENT);

  double Point=Point();

  //Etc.

  //:::::::::::::::::::::::::::::::::::::::::::::::



   return(rates_total);

}



Thanks

Reason: