Blinking text in mt4

 

Please house,  I need any help with a code snippet for blinking text in mt4 

 I have this graphical display board that shows so many signals for multiple currencies and timeframe. I want the arrow of new incoming signal to blink for 20 seconds using OnTimer() so I can recognize new arrow that is formed.



 
Your topic has been moved to the section: MQL4 and MetaTrader 4
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

If you show your attempts, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.

Otherwise, you also have the option to hire a programmer in the Freelance section.

 
Fernando Carreiro #:

If you show your attempts, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.

Otherwise, you also have the option to hire a programmer in the Freelance section.

I just need instruction on how go about it.  At least mt4 code sample or link to any article on it Pls

 below is the class I got from https://www.mql5.com/en/articles/3004 but I don't know how to apply it in my case

class CTextBox : public CElement
  {
private:
   //--- Displays the text and blinking cursor
   void              DrawTextAndCursor(const bool show_state=false);
  };
//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
CTextBox::CTextBox(void)
  {
//--- Setting parameters for the timer counter
   m_counter.SetParameters(16,200);
  }
//+------------------------------------------------------------------+
//| Timer                                                            |
//+------------------------------------------------------------------+
void CTextBox::OnEventTimer(void)
  {
...
//--- Pause between updates of the text cursor
   if(m_counter.CheckTimeCounter())
     {
      //--- Update the text cursor if the control is visible and the text box is activated
      if(CElementBase::IsVisible() && m_text_edit_state)
         DrawTextAndCursor();
     }
  }
//+------------------------------------------------------------------+
//| Displays the text and blinking cursor                            |
//+------------------------------------------------------------------+
void CTextBox::DrawTextAndCursor(const bool show_state=false)
  {
//--- Determine the state for the text cursor (show/hide)
   static bool state=false;
   state=(!show_state)? !state : show_state;
//--- Output the text
   CTextBox::TextOut();
//--- Draw the text cursor
   if(state)
      DrawCursor();
//--- Draw the frame
   DrawBorder();
//--- Update the text box
   m_canvas.Update();
//--- Reset the counter
   m_counter.ZeroTimeCounter();
  }
Graphical Interfaces X: The Multiline Text box control (build 8)
Graphical Interfaces X: The Multiline Text box control (build 8)
  • www.mql5.com
The Multiline Text box control is discussed. Unlike the graphical objects of the OBJ_EDIT type, the presented version will not have restrictions on the number of input characters. It also adds the mode for turning the text box into a simple text editor, where the cursor can be moved using the mouse or keys.
 
Gbenga Ayodele #:

I just need instruction on how go about it.  At least mt4 code sample or link to any article on it Pls

 below is the class I got from https://www.mql5.com/en/articles/3004 but I don't know how to apply it in my case

this is my suggestion:

1- add an identifier to each object (in your case arrows) to know which one has to blink. (I recommend use OBJPROP_ZORDER)

2- save start time of blinking of that specific Arrow to this property (OBJPROP_ZORDER) of that Arrow. This may done during first time you draw arrow on chart.

3- have a setting as how many seconds you want to blink like Xsec. Also another input as speed of blink like NperSec. (N Times Per Seconds).

4- code a function that checks all arrows to find out which one needs to blink yet. you may know how to do this. just compare TimeCurrent() with time you set as start of blink. if OBJPROP_TIMEFRAMES property for Arrow is OBJ_ALL_PERIODS make it OBJ_NO_PERIODS and vice versa. 

5- run that function 2N times per seconds inside of OnTimer(). you will need to set Time inside of OnInit function as EventSetMillisecondTimer((int) (1000000/NperSec/2));

thats it!


- consider this may affect your indicator speed dramatically.

- if you have clicking operations on arrows, this may has another bad effect as you are playing with ZOrder continuously. 

 
maybe these new arrows should be a lighter colour instead?, eg light blue and magenta? These would stand out more than a blinking arrow, right?
 
I think it would be a better idea to use a different arrow type or different arrow color for fresh signals instead of blinking, it is obvious that you have to add an array of datetime variables in order to save the new arrows time and after a specific time turn them as normal arrows.
Reason: