Help Creating Chart Objects

 

Looking for help to create objects in MQL5 using less lines of code. I keep getting a "doesn't not have body" error.

In MQL4, I can do this

/// MT4 lets me do this
int FunctionLabels(string LabelName, int LabelCorner, int LabelXValue, int LableYValue, string LabelText, int FontSize, color LabelColor) 
   { ObjectCreate(LabelName, OBJ_LABEL, 0, 0, 0);
     ObjectSet(LabelName, OBJPROP_CORNER, LabelCorner);
     ObjectSet(LabelName, OBJPROP_XDISTANCE, LabelXValue);
     ObjectSet(LabelName, OBJPROP_YDISTANCE, LableYValue);
     ObjectSetText(LabelName, LabelText, FontSize, "Arial",LabelColor);
    }

///Then Create Lables here using Less Lines of Code

FunctionLabels ("Item1", 1, 58, 44, Name1, 20, Black);
FunctionLabels ("Item2", 1, 58, 64, Name2, 20, Black);

/// In MT5 I have to use full code each time for every Label??

    ObjectCreate    (0,"Item1", OBJ_LABEL, 0, 0, 0);
    ObjectSetInteger(0,"Item1", OBJPROP_XDISTANCE, 58);
    ObjectSetInteger(0,"Item1", OBJPROP_YDISTANCE, 44);
    ObjectSetInteger(0,"Item1", OBJPROP_CORNER, CORNER_RIGHT_UPPER); 
    ObjectSetString (0,"Item1", OBJPROP_TEXT, Name1);  
    ObjectSetString (0,"Item1", OBJPROP_FONT, "Arial");
    ObjectSetInteger(0,"Item1", OBJPROP_FONTSIZE,20);      
    ObjectSetInteger(0,"Item1", OBJPROP_ANCHOR, ANCHOR_RIGHT_UPPER);               
    ObjectSetInteger(0,"Item1", OBJPROP_COLOR,clrBlack);
 
JPS1:

Looking for help to create objects in MQL5 using less lines of code. I keep getting a "doesn't not have body" error.

In MQL4, I can do this

Obviously not, simply create a function like you do in MT4. If you have an error post the code with the error and the error message.
Reason: