Watermark
Download scriptThe Watermark script is designed as a visual enhancement for your trading charts, providing clear and customizable information at a glance. Its primary purpose is to display the current asset (symbol) and timeframe directly on the background of your trading window, ensuring you always have immediate context regarding what you are viewing.
Core Functionality
The script automatically identifies which currency pair or asset you are currently trading and determines the corresponding timeframe (such as 1-minute, Hourly, Daily, etc.). It then renders this information as a large "watermark" on your screen.
To ensure the interface remains clean and efficient, the logic is designed to only refresh the text whenever the visible price range of your chart changes. This prevents unnecessary processing while keeping the information accurate as you scroll or zoom through different historical data.
Key Features & Customization
The script offers a high degree of flexibility for users who want to tailor their workspace:
- Primary Symbol Display: You can customize the appearance of the main watermark by adjusting the font style, the size of the text, and the specific RGB color values (Red, Green, and Blue).
- Positioning: The script allows you to define exact coordinates (X and Y positions) for both the primary symbol information and any custom text, giving you full control over where these elements appear on your screen.
- Custom Tags: Beyond just showing the market data, the script includes a "Tag" feature. This allows you to display personalized information, such as your name, a website link, or an email address, in a separate location on the chart.
- Visual Hierarchy: The main symbol watermark is designed to be large and prominent, while the custom tag can be configured with different settings (like smaller font sizes or different colors) to act as a secondary piece of information.
User Experience
From a user perspective, once the indicator is loaded, it automatically handles the heavy lifting of identifying your chart's data. You simply set your preferences during the initial setup—such as colors and locations—and the script maintains a clean, professional-looking background that stays consistent as you navigate your trading platform.
//+------------------------------------------------------------------+
//| Watermark.mq4 |
//| Copyright © M00SE 2011 |
//| |
//| W A T E R M A R K |
//| |
//| This indicator will display a symbol watermark on the chart |
//| background, showing the timeframe and symbol name in large font. |
//| |
//| Version 1 - 16 Jun 2011 |
//| |
//| |
//| Instructions |
//| |
//| Choose the symbol you're interested in and display it in a chart |
//| window at the appropriate timeframe. Load the Watermark |
//| indicator and optionally choose font, size, colour, position etc.|
//| Additionally you may choose to add some custom text of your own, |
//| eg. web link, email address etc. in a tag field. |
//| |
//| That's it! |
//| Hope you like it, MOOSE. |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © M00SE 2011"
#property indicator_chart_window
//---- input parameters
extern int sidFontSize = 140;
extern string sidFontName = "Ariel";
extern string NoteRedGreenBlue = "Red/Green/Blue each 0..255";
extern int sidRed = 30;
extern int sidGreen = 30;
extern int sidBlue = 30;
extern int sidXPos = 30;
extern int sidYPos = 150;
extern bool tagDisplayText = true;
extern string tagText = "[Your Name Here]";
extern int tagFontSize = 20;
extern string tagFontName = "Tahoma";
extern int tagRed = 60;
extern int tagGreen = 30;
extern int tagBlue = 60;
extern int tagXPos = 600;
extern int tagYPos = 550;
//---- data
string SID = "Symbol";
int sidRGB = 0;
string TAG = "Tag";
int tagRGB = 0;
string tf;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
switch(Period())
{
case PERIOD_D1:
tf="d1";
break;
case PERIOD_H1:
tf="h1";
break;
case PERIOD_H4:
tf="h4";
break;
case PERIOD_M1:
tf="m1";
break;
case PERIOD_M15:
tf="m15";
break;
case PERIOD_M30:
tf="m30";
break;
case PERIOD_M5:
tf="m5";
break;
case PERIOD_MN1:
tf="mn1";
break;
case PERIOD_W1:
tf="w1";
break;
default:
tf="Unknown";
break;
}
if(tagRed > 255 || tagGreen > 255 || tagBlue > 255 || sidRed > 255 || sidGreen > 255 || sidBlue > 255)
{
Alert("Watermark Red/Green/Blue components must each be in range 0..255");
}
tagRGB = (tagBlue << 16);
tagRGB |= (tagGreen << 8);
tagRGB |= tagRed;
sidRGB = (sidBlue << 16);
sidRGB |= (sidGreen << 8);
sidRGB |= sidRed;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete(SID);
ObjectDelete(TAG);
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double chartHi, chartLo;
double range;
static double prevRange;
chartHi = WindowPriceMax(0);
chartLo = WindowPriceMin(0);
range = chartHi - chartLo;
// need only draw the watermark if the chart range has changed
if(prevRange != range)
{
deinit();
prevRange = range;
watermark(SID, tf + Symbol(), sidFontSize, sidFontName, sidRGB, sidXPos, sidYPos);
if(tagDisplayText && StringLen(tagText) > 0)
{
watermark(TAG, tagText, tagFontSize, tagFontName, tagRGB, tagXPos, tagYPos);
}
}
return(0);
}
void watermark(string obj, string text, int fontSize, string fontName, color colour, int xPos, int yPos)
{
ObjectCreate(obj, OBJ_LABEL, 0, 0, 0);
ObjectSetText(obj, text, fontSize, fontName, colour);
ObjectSet(obj, OBJPROP_CORNER, 0);
ObjectSet(obj, OBJPROP_XDISTANCE, xPos);
ObjectSet(obj, OBJPROP_YDISTANCE, yPos);
ObjectSet(obj, OBJPROP_BACK, true);
}
Comments