Download MetaTrader 5
To add comments, please log in or register
Ask your broker to open the official channel. Thousands of traders will read the news!
Karish
133
Karish 2016.06.13 00:55 

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!

Janek6191
29
Janek6191 2016.06.13 04:13  
// where ProfitLabel is the object name
void OnTick(){
       
    ObjectSetString(chart_ID,"ProfitLabel",OBJPROP_TEXT,DoubleToStr(profit,2));
}
Karish
133
Karish 2016.06.13 05:26  

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

whroeder1
13596
whroeder1 2016.06.13 12:57  
  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);

Karish
133
Karish 2016.06.13 17:37  

@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..! 

Keith Watford
Moderator
7887
Keith Watford 2016.06.14 01:38  
   static string text=".";
   if(text=="......")
      text=".";
   //Set the text in the object
   text+=".";

.

Karish
133
Karish 2016.06.14 09:38  
Thanks!!
/
To add comments, please log in or register