Display Value of a Variable on Chart

 

Hi all,

 My EA strategy's adapts according to various market setting which are represented by X that can take the Value of -2,-1,0,1,2.

In order for the EA to be more user friendly I would like to display on the Chart the Value of X.

 I used the following code:

   
ObjectCreate("XValue", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Xvalue",X,7, "Verdana", Red);
ObjectSet("Xvalue", OBJPROP_CORNER, 0);
ObjectSet("Xvalue", OBJPROP_XDISTANCE, 20);
ObjectSet("Xvalue", OBJPROP_YDISTANCE, 20);

 

But the only thing showing is a grey text "Label" .

 

Any idea where the erro comes from?

 

Bests,

Andrea 

 
pipokito:

Hi all,

 My EA strategy's adapts according to various market setting which are represented by X that can take the Value of -2,-1,0,1,2.

In order for the EA to be more user friendly I would like to display on the Chart the Value of X.

 I used the following code:

 

But the only thing showing is a grey text "Label" .

 

Any idea where the erro comes from?

 

Bests,

Andrea 

variables are case sensitive  ie "XValue" should be "Xvalue" 

 

Thanks,

you're right!

 

I used

 

Comment("RSI30_70="+RSI30_70 + "\n" + "RSI50_80="+RSI50_80 + "\n" + "RSI50_20="+RSI50_20 + "\n" + "X Value =" + X);

 

instead.

 

But thank you for your reply,

 

Have a great life ;) 

 

I'm not sure that you have understood what Rod pointed out to you

ObjectCreate("XValue", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Xvalue",X,7, "Verdana", Red);

The 1st "XValue" has a capital V, the rest a lower case v

 

The 1st "XValue" has a capital V, the rest a lower case v

yes, you got it
 
           ObjectCreate("x",OBJ_LABEL,0,0,0);
           ObjectSet("x",OBJPROP_CORNER,CORNER_LEFT_UPPER);
           ObjectSet("x",OBJPROP_XDISTANCE,10);
           ObjectSet("x",OBJPROP_YDISTANCE,120);

           ObjectSetText("x","Sellindicator:"+DoubleToStr(t1,Digits),20,"Arial",Red);



try this