Change text of an object on every second by OnTimer?

 

Hello,

A bit newbie question.., but how can i make a text of an object to change itself on every second for example:

 

text object #1 will be change every second like so:

"."

".."

"..."

"...."

"....."

and then back to "." and same loop again and again.., thank you guys!

 
// where ProfitLabel is the object name
void OnTick(){
       
    ObjectSetString(chart_ID,"ProfitLabel",OBJPROP_TEXT,DoubleToStr(profit,2));
}
 

sorry i edited the OnTick to OnTimer, please help, it support to be OnTimer...!

 
  1. OnTick or OnTimer is irrelevant. You must set the text. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. string text = "12345";
    string curr = ObjectGetString(chart_ID,"ProfitLabel",OBJPROP_TEXT);
    int    len  = (StringLen(curr) % StringLen(text)) + 1;              // 1->2->3->4->5->1
    string next = StringSubstr(text, 0, len);                           // "1","12"...
    ObjectSetString(chart_ID,"ProfitLabel",OBJPROP_TEXT, next);

 

@WHRoeder, thank you for your help, i understand, but the function "OnTimer()" is new for me..,

 

i'm just trying to make a simple text change every 1 second.., like so for example:

"."

".."

"..."

"...."

"....."

and then the text will return to the first text in a loop and so on every 1 second... 

 

please help..., thank you..! 

 
   static string text=".";
   if(text=="......")
      text=".";
   //Set the text in the object
   text+=".";

.

 
Thanks!!
Reason: