Difference between HLineCreate() and ObjectCreate(OBJ_HLINE)

 

Hi everyone

I'm pretty new into coding with MQL.

I'd like to creat a horizontal line and I have seen two ways to do it:

I just see that the first option is just more code but easyer to analyse... Is there any difference for the compiler or something?

First Option:

ObjectCreate    (0, SELL_ENTRY_H_LINE, OBJ_HLINE, 0,0, price);
ObjectSetInteger(0, SELL_ENTRY_H_LINE, OBJPROP_COLOR, clrGreen);  
ObjectSetInteger(0, SELL_ENTRY_H_LINE, OBJPROP_STYLE, STYLE_SOLID);  
ObjectSetInteger(0, SELL_ENTRY_H_LINE, OBJPROP_WIDTH, 2);  
ObjectSetInteger(0, SELL_ENTRY_H_LINE, OBJPROP_BACK, false);  
ObjectSetInteger(0, SELL_ENTRY_H_LINE, OBJPROP_SELECTABLE, false);
ObjectSetInteger(0, SELL_ENTRY_H_LINE, OBJPROP_HIDDEN, false); 
ObjectSetInteger(0, SELL_ENTRY_H_LINE, OBJPROP_ZORDER, 0); 

Second Option:

HLineCreate(0, SELL_ENTRY_H_LINE, 0, price, clrGreen, STYLE_SOLID, 2, false, false, false, 0)  

 
Lukas Roth:

Hi everyone

I'm pretty new into coding with MQL.

I'd like to creat a horizontal line and I have seen two ways to do it:

I just see that the first option is just more code but easyer to analyse... Is there any difference for the compiler or something?

First Option:

Second Option:

Your second option is a function call and will do nothing unless there is also a function called HLineCreate() in the code.

Reason: