Display Value of a Variable on Chart

Back to topics list To post a new topic, please log in or register
avatar
5
pipokito 2016.08.11 17:33
 

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 

avatar
164
rod178 2016.08.11 17:55 #
 
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" 

 

 

avatar
5
pipokito 2016.08.11 20:27 #
 

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 ;) 

avatar
Moderator
3404
GumRai 2016.08.11 22:13 #
 

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

avatar
164
rod178 2016.08.12 08:15 #
 

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

yes, you got it
Back to topics list  

To add comments, please log in or register