Refreshing OBJ_LABEL

 

Hello all,


Alright, I`m gonna be the noob of the day, but going through the docs and examples, there is something that I conceptually don't get .


Right now if I display an OBJ_LABEL on the chart, it takes the value at the time of the initialisation of the EA and that`s it .

What is the correct method to refresh (this value and others )at every tick ?



thanks,

sorry if this question has been raised 10000 times ..

 

All grafical objects are refreshed automatically after tick incoming. But you can use WindowRedraw function to force refreshing

 

thank you for your reply, so, if I've got :


int init()
{
Create();
return;
}

int Create()
{

double MA_1_t;
double MA_2_t;

MA_1_t=iMA(NULL,0,Period_MA_1,0,MODE_SMA,PRICE_CLOSE,0);

ObjectCreate("SMA_1", OBJ_LABEL, 0, 0, 0);
ObjectSet("SMA_1", OBJPROP_CORNER, 0);
ObjectSet("SMA_1", OBJPROP_XDISTANCE, 10);
ObjectSet("SMA_1", OBJPROP_YDISTANCE, 15);
ObjectSetText("SMA_1",DoubleToStr(MA_1_t,5),20,"Arial",Cyan);


WindowRedraw();

}

This should redraw at every tick, right ? But it doesn't :(

 
julz wrote >>

This should redraw at every tick, right ? But it doesn't :(

Nor will it - init() only fires once on load of the EA

Somewhere in the start() function you need an update function to get the current MA value and do an ObjectSetText

start() fires every tick - assuming its finished processing the last one when the new one comes in :)

Also then maybe WindowRedraw might be needed

Good Luck

-BB-

 

that does make sense, thank you for explaining .