please help fix this label function

Back to topics list To post a new topic, please log in or register
avatar
27
preet.k.gill.92 2015.08.11 07:00
 

my function call line in start() is

  LN(1,"+ 100", H, White);

my function is


void LN(double n, string nm, double val, color CL)

{

   string NN = nm + DoubleToStr(n,0);

   ObjectDelete(NN);

   ObjectCreate(0,NN,OBJ_HLINE,0,0,val);

   ObjectSet(NN,OBJPROP_COLOR,CL);

   

   string nmL = NN + "_Label";

   double VL = ObjectGet(NN,OBJPROP_PRICE1)

   ;

   ObjectCreate(0,nmL,OBJ_LABEL,Time[0],VL);

   ObjectSetText(nmL,nm,10,"Arial",CL);

   


    

}

my problem is that line labels are not being shown on chart, i know i am doing something wrong but after countless hours of wasting time i decided to look for expert opinion

please guide

 

avatar
Moderator
3418
GumRai 2015.08.11 08:58 #
 

Pleas use variable names that help to recognise what they are.

Even your small section of code is not easy to follow

ObjectCreate(0,nmL,OBJ_LABEL,Time[0],VL);

 A label uses x and y pixels as co-ordinates, not time and price

avatar
872
eevviill 2015.08.11 09:46 #
 
GumRai:

Pleas use variable names that help to recognise what they are.

Even your small section of code is not easy to follow

 A label uses x and y pixels as co-ordinates, not time and price

Yes.

OBJECT_SET(X_DISTANCE) 

 OBJECT_SET(Y_DISTANCE) 

Back to topics list  

To add comments, please log in or register