template_name

Download script
Author: Copyright 2014, MetaQuotes Software Corp.
template_name

This tool is designed to enhance your trading workspace by providing a customizable text label directly on your MetaTrader chart. It allows you to quickly identify and organize different charts by displaying a specific name or title in the designated corner of your screen.

How it Works

The script functions by creating a dynamic visual element on your price chart. Instead of cluttering the interface with multiple windows, it places a clear text label that helps you keep track of which currency pair, timeframe, or trading strategy you are currently viewing.

Key features include:

  • Custom Branding: You can set a specific "Template Name" to act as a header for your chart, making it easier to navigate between multiple open tabs.
  • Visual Customization: The script provides several options to match the text style to your personal preference. You can choose the font color, adjust the size of the lettering, and toggle between standard and bold weights.
  • Precision Placement: You have full control over where the label appears on the screen. By adjusting the horizontal and vertical distance settings, you can position the text in any corner (such as top-left, bottom-right, etc.) to ensure it does not overlap with your price candles or other technical indicators.
  • Automatic Cleanup: The script is designed to be efficient; it automatically creates the label when loaded and ensures that the label is removed from the chart once you remove the script, keeping your workspace clean.

Essentially, this tool acts as a digital "signpost," allowing for a more organized and professional trading environment by clearly labeling your various market views.

6 Views
0 Downloads
0 Favorites
template_name
//+--------------------------------------------------------------------+
//|                                                 Template Names.mq4 |
//|                          Copyright 2014, MetaQuotes Software Corp. |
//|                                               http://www.mql5.com  |
//|                                                                    |
//| Author: file45 - https://www.mql5.com/en/users/file45/publications |
//+--------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window

input string Template_Name = "Template Name"; // Template Name
input color  Text_Color    = LightSlateGray; // Font Color
input int    Text_Size     = 20; // Font Size
input bool   Font_Bold     = false; // Font Bold
input int    Left_Right    = 250; // Left - Right
input int    Up_Down       = 20; // Up - Down
input int    Corner_       = 0; // Corner

string Text_Font;

int OnInit()
{
   switch(Font_Bold)
   {
      case 0: Text_Font = "Arial"; break;
      case 1: Text_Font = "Arial Bold";break;
   }   

   return(INIT_SUCCEEDED);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   string Templ_Name = Template_Name;
       
   RefreshRates();
   ObjectCreate("TemplName", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("TemplName", Templ_Name, Text_Size, Text_Font,  Text_Color);
   ObjectSet("TemplName", OBJPROP_CORNER, Corner_);
   ObjectSet("TemplName", OBJPROP_XDISTANCE, Left_Right);
   ObjectSet("TemplName", OBJPROP_YDISTANCE, Up_Down);  
   
   return(rates_total);
}


int deinit()
{
    ObjectDelete("TemplName");
    
    return(0);
}

Comments