How can I solve the redraw of chart object after timeframe change? - page 3

 
pecskeke1976:
Solved.
So what was the problem?
 
GumRai:
So what was the problem?

I think the problem was the not right mql4 function using.

In the first code as I posted here I have used this code:

ObjectSetString(0,"profit_usd",OBJPROP_TEXT,infowindow_upper);

After several attempt I have changed the code this way:
I changed ObjectSetString to ObjectSetText and in every tick the EA use ObjectCreate without ChartID() and I don't use in ObjectSetText too.

The new code that is working:

ObjectCreate("profit_usd",OBJ_LABEL,0,0,0);                        
ObjectCreate("profit_text",OBJ_LABEL,0,0,0);
ObjectSet("profit_usd",OBJPROP_XDISTANCE,1100);
ObjectSet("profit_usd",OBJPROP_YDISTANCE,20);                                  
ObjectSet("profit_usd",OBJPROP_COLOR,clrWhite);                                  
ObjectSet("profit_usd",OBJPROP_FONTSIZE,14);
ObjectSet("profit_text",OBJPROP_XDISTANCE,1040);
ObjectSet("profit_text",OBJPROP_YDISTANCE,20);                                   
ObjectSet("profit_text",OBJPROP_COLOR,clrWhite);                                   
ObjectSet("profit_text",OBJPROP_FONTSIZE,14);
ObjectSetText("profit_text","Profit:",12,"Courier New",Yellow);
infowindow_upper=DoubleToString(total_profit,2);
ObjectSetText("profit_usd",infowindow_upper,12,"Courier New",Yellow);

As you see there is no ChartID().

And at least in the code:

WindowRedraw();
 
Keith Watford #:
So what was the problem?
Gabor Keresztessy #:

I think the problem was the not right mql4 function using.

In the first code as I posted here I have used this code:

After several attempt I have changed the code this way:
I changed ObjectSetString to ObjectSetText and in every tick the EA use ObjectCreate without ChartID() and I don't use in ObjectSetText too.

The new code that is working:

As you see there is no ChartID().

And at least in the code:

This saved my day.
I've same problem with MT5 code.

It's working after I changed ObjectSetString to ObjectSetText

Thank you

Reason: