Author: Copyright � 2007, Nikolay Kositsin
PrintText

This script is designed to create a dynamic, multi-stage visual notification system on a MetaTrader trading chart. It serves as an interactive "presentation" or status display that guides the user through several informational steps by manipulating text labels, colors, and sounds.

Core Functional Logic

The script follows a sequential execution path, moving through distinct phases of visual communication:

1. Dynamic Text Creation The tool contains internal instructions to generate specific text elements (labels) on different areas of the trading screen—specifically targeting the top-left, top-right, and bottom-left corners. For each section, it establishes a unique environment by defining the font style, size, and color of the information being displayed.

2. Sequential Counting & Audio Feedback A key feature of this script is its ability to perform an automated countdown or "counting" sequence. During these specific phases:

  • The script generates a numeric counter that updates on the screen in real-time.
  • It introduces a rhythmic delay between each number change, ensuring the user can follow the progress.
  • It triggers a specific system sound ("WAIT") at every increment of the count to provide an auditory cue of the script's progression.

3. Iterative Corner Rotation The logic is programmed to cycle through all four corners of the trading chart. It systematically displays different colored text sets in each corner, performs its counting sequence, and then cleans up those labels before moving on to the next corner. This ensures that the visual information covers the entire periphery of the workspace.

4. Final Status Completion After completing the rotation through all corners, the script performs a final "completion" sequence. It displays a large notification message at the bottom of the screen and cycles through a rainbow of colors (Yellow, Red, Lime, Magenta, Blue, Aqua) to grab the user's attention. The process concludes with an alert sound and the removal of all remaining text elements, leaving the chart clean once the operation is finished.

Summary of User Experience

When executed, the script provides a choreographed visual "tour." It announces its status, counts down numerically with audio feedback in every corner of the screen to demonstrate its reach, and finally provides a color-changing completion message before shutting down cleanly.

Miscellaneous
It plays sound alerts
7 Views
0 Downloads
0 Favorites
PrintText
//+X================================================================X+  
//|                                                    PrintText.mq4 | 
//|                           Copyright © 2007,     Nikolay Kositsin | 
//|                              Khabarovsk,   farria@mail.redcom.ru | 
//+X================================================================X+  
#property copyright "Copyright © 2007, Nikolay Kositsin"
#property link "farria@mail.redcom.ru" 
#property show_confirm
//+------------------------------------------------------------------+
//| Äåìîíñòðàöèîííûé ñêðèïò äëÿ âûâîäà òåêñòîâûõ ëåéá                |
//+------------------------------------------------------------------+

//+X================================================================X+ 
//| CreateTextLable() function                                       |
//+X================================================================X+ 
void CreateTextLable
 (string TextLableName, string Text, int TextSize, string FontName, color TextColor, int TextCorner, int X, int Y )
  { 
//---
   ObjectCreate(TextLableName, OBJ_LABEL, 0, 0, 0);
   ObjectSet(TextLableName, OBJPROP_CORNER, TextCorner);
   ObjectSet(TextLableName, OBJPROP_XDISTANCE, X);
   ObjectSet(TextLableName, OBJPROP_YDISTANCE, Y);
   ObjectSetText(TextLableName,Text,TextSize,FontName,TextColor);
//---- 
  }
//+X================================================================X+ 
//| SetTextLable() function                                          |
//+X================================================================X+ 
void SetTextLable
 (string TextLableName, string Text, int TextSize, string FontName, color TextColor, int TextCorner, int X, int Y )
  { 
//---
   ObjectSet(TextLableName, OBJPROP_CORNER, TextCorner);
   ObjectSet(TextLableName, OBJPROP_XDISTANCE, X);
   ObjectSet(TextLableName, OBJPROP_YDISTANCE, Y);
   ObjectSetText(TextLableName,Text,TextSize,FontName,TextColor);
//---- 
  }
//+X================================================================X+ 
//| TimeCount() function                                            |
//+X================================================================X+
void TimeCount
 (string TextLableName, int StartNumber, int StopNumber, int Inerval, int TextSize, string FontName, color TextColor, int TextCorner, int X, int Y )
  { 
//---
   CreateTextLable(TextLableName,"-"+StartNumber+"-",TextSize,FontName,TextColor,TextCorner,X,Y);
   WindowRedraw();
   PlaySound("WAIT");
   for(int Count=StartNumber+1;Count<=StopNumber;Count++)
    {
     Sleep(Inerval);
     PlaySound("WAIT");
     SetTextLable(TextLableName,"-"+ Count+"-",TextSize,FontName,TextColor,TextCorner,X,Y);
     WindowRedraw();
    }
   Sleep(Inerval);
   ObjectDelete(TextLableName);
//---- 
  }
//+X================================================================X+ 
//|PrintText start function                                          |
//+X================================================================X+
int start()
  {
   string STRING1="Äåìîíñòðàöèÿ ðàáîòû ñêðèïòà ";
   string STRING2="PrintText.mq4";
   string STRING3="×åðåç ïÿòü ñåêóíä ýòîò òåêñò èñ÷åçíåò";
   string STRING4="Ðàáîòà ñêðèïòà çàâåðøåíà";
   
   //----+ ÂÛÂÎÄ ÒÅÊÑÒÀ Â ËÅÂÎÌ ÂÅÐÕÍÅÌ ÓÃËÓ ÃÐÀÔÈÊÀ
   CreateTextLable("label_object1",STRING1,20,"Times New Roman",Yellow,0,30,10);
   CreateTextLable("label_object2",STRING2,20,"Times New Roman",Blue,0,380,10);
   CreateTextLable("label_object3",STRING3,25,"Times New Roman",Red,0,10,30);   
   WindowRedraw(); 
   TimeCount("label_objectX",0,5,1000,300,"Times New Roman",Red,1,600,320);
   ObjectDelete("label_object1");
   ObjectDelete("label_object2");
   ObjectDelete("label_object3");
   
   //----+ ÂÛÂÎÄ ÒÅÊÑÒÀ Â ÏÐÀÂÎÌ ÂÅÐÕÍÅÌ ÓÃËÓ ÃÐÀÔÈÊÀ
   CreateTextLable("label_object1",STRING1,20,"Times New Roman",Red,1,170,10);
   CreateTextLable("label_object2",STRING2,20,"Times New Roman",Lime,1,20,10);
   CreateTextLable("label_object3",STRING3,25,"Times New Roman",Magenta,1,10,30);
   WindowRedraw();
   TimeCount("label_objectX",0,5,1000,300,"Times New Roman",Lime,1,600,320); 
   ObjectDelete("label_object1");
   ObjectDelete("label_object2");
   ObjectDelete("label_object3");
   //----+ ÂÛÂÎÄ ÒÅÊÑÒÀ Â ÏÐÀÂÎÌ ÍÈÆÍÅÌ ÓÃËÓ ÃÐÀÔÈÊÀ
   CreateTextLable("label_object1",STRING1,20,"Times New Roman",Aqua,3,170,10);
   CreateTextLable("label_object2",STRING2,20,"Times New Roman",DeepPink,3,20,10);
   CreateTextLable("label_object3",STRING3,25,"Times New Roman",MediumSlateBlue,3,10,30);
   WindowRedraw();
   TimeCount("label_objectX",0,5,1000,300,"Times New Roman",Magenta,1,600,320);
   ObjectDelete("label_object1");
   ObjectDelete("label_object2");
   ObjectDelete("label_object3");
   
   //----+ ÂÛÂÎÄ ÒÅÊÑÒÀ Â ËÅÂÎÌ ÂÅÐÕÍÅÌ ÓÃËÓ ÃÐÀÔÈÊÀ
   CreateTextLable("label_object1",STRING1,20,"Times New Roman",Lime,2,30,10);
   CreateTextLable("label_object2",STRING2,20,"Times New Roman",BlueViolet,2,380,10);
   CreateTextLable("label_object3",STRING3,25,"Times New Roman",Orange,2,10,30);
   WindowRedraw();
   TimeCount("label_objectX",0,5,1000,300,"Times New Roman",Yellow,1,600,320);
   ObjectDelete("label_object1");
   ObjectDelete("label_object2");
   ObjectDelete("label_object3");
   //----+ ÂÛÂÎÄ ÒÅÊÑÒÀ ÏÎ ÖÅÍÒÐÓ ÃÐÀÔÈÊÀ
   CreateTextLable("label_object4",STRING4,50,"Times New Roman",Yellow,0,365,463);
   WindowRedraw();
   Sleep(500);
   SetTextLable("label_object4",STRING4,50,"Times New Roman",Red,0,365,463);
   WindowRedraw();
   Sleep(500);
   SetTextLable("label_object4",STRING4,50,"Times New Roman",Lime,0,365,463);
   WindowRedraw();
   Sleep(500);
   SetTextLable("label_object4",STRING4,50,"Times New Roman",Magenta,0,365,463);
   WindowRedraw();
   Sleep(500);
   SetTextLable("label_object4",STRING4,50,"Times New Roman",Blue,0,365,463);
   WindowRedraw();
   Sleep(500);
   SetTextLable("label_object4",STRING4,50,"Times New Roman",Aqua,0,365,463);
   PlaySound("ALERT");
   WindowRedraw();
   Sleep(500);
   ObjectDelete("label_object4");
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments