_Chart Market Price
Download scriptThis script is designed to enhance your trading experience on the MetaTrader 4 platform by providing a real-time, easy-to-read dashboard of essential market data directly on your chart. Instead of having to look at different tabs or windows to track moving prices and key levels, this tool consolidates everything into a clean, organized display in any corner of your screen that you choose.
Key Functionalities
Real-Time Price Tracking The tool displays the current Bid (the price at which you can sell) and Ask (the price at which you can buy) prices instantly. To help you visualize market momentum at a glance, it includes a dynamic color-coding system:
- If the price is moving up compared to its previous value, the text changes to green.
- If the price is dropping, the text switches to red.
Spread Monitoring One of the most important metrics for traders is the "spread"—the difference between the buy and sell prices. This script calculates that difference automatically and displays it clearly on your screen, allowing you to monitor transaction costs in real-time.
Key Level Identification To assist with your technical analysis, the tool automatically pulls and displays two significant price benchmarks:
- Daily Open: The price at which the current trading day began.
- Weekly Open: The price at which the current trading week began. Having these levels visible helps you quickly identify whether the market is trading above or below major session starts.
Customization Options
The script is built to be user-friendly and highly adaptable to your personal workspace preferences. You can easily adjust:
- Visual Style: Customize the font type, size, and colors to match your theme.
- Placement: Choose exactly which corner of the chart you want the information to appear in (Upper Left, Upper Right, Lower Left, or Lower Right).
- Layout: Adjust the spacing between the different lines of text to ensure the dashboard sits perfectly where you need it without obstructing your view of the candles.
In summary, this tool simplifies your workflow by pulling vital market data—current prices, spread, and opening levels—into a single, color-coded visual summary that updates automatically as the market moves.
//+------------------------------------------------------------------+
//| _Chart Market Price.mq4 |
//| djindyfx@sbcglobal.net |
//| http://www.learncurrencytrading.com/fxforum/blogs/djindyfx/ |
//+------------------------------------------------------------------+
#property copyright "djindyfx@sbcglobal.net"
#property link "http://www.learncurrencytrading.com/fxforum/blogs/djindyfx/"
#property indicator_chart_window
extern string note1 = "Change font colors automatically? True = Yes";
extern bool Bid_Ask_Colors = True;
extern string note2 = "Default Font Color";
extern color FontColor = Black;
extern color FontColor2 = Black;
extern string note3 = "Font Size";
extern int FontSize=15;
extern string note4 = "Font Type";
extern string FontType="Times new roman";
extern string note5 = "Display the price in what corner?";
extern string note6 = "Upper left=0; Upper right=1";
extern string note7 = "Lower left=2; Lower right=3";
extern int WhatCorner=1;
extern int MoveUpDown = 15 ;
extern int SideDistance = 2;
double Old_Price;
double Old_Price2;
double SpreadPrice;
double DailyOpen;
double WeeklyOpen;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("Market_Price_Label");
ObjectDelete("Market_Price_Label2");
ObjectDelete("Market_Price_Label3");
ObjectDelete("Daily_Open_Label");
ObjectDelete("Weekly_Open_Label");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
if (Bid_Ask_Colors == True)
{
if (Bid > Old_Price) FontColor = LawnGreen;
if (Bid < Old_Price) FontColor = Red;
if (Ask > Old_Price2) FontColor2 = LawnGreen;
if (Ask < Old_Price2) FontColor2 = Red;
Old_Price = Bid;
Old_Price2 = Ask;
SpreadPrice = (Ask-Bid)/Point;
}
DailyOpen = iOpen(NULL,PERIOD_D1,0);
WeeklyOpen = iOpen(NULL,PERIOD_W1,0);
string Market_Price2 = DoubleToStr(Ask, Digits);
string Market_Price = DoubleToStr(Bid, Digits);
string Market_Spread = DoubleToStr(SpreadPrice,0);
string DOpen = DoubleToStr(DailyOpen,Digits);
string WOpen = DoubleToStr (WeeklyOpen,Digits);
//-----
int YInitialDistance, Ydist01, Ydist02, Ydist03, Ydist04, Ydist05,Ydist06, DistFromSide, YDistInc;
DistFromSide = SideDistance;
YInitialDistance = MoveUpDown;
YDistInc = 25;
Ydist01 = YInitialDistance + YDistInc;
Ydist02 = Ydist01 + YDistInc;
Ydist03 = Ydist02 + YDistInc;
Ydist04 = Ydist03 + YDistInc;
Ydist05 = Ydist04 + YDistInc;
Ydist06 = Ydist05 + YDistInc;
//-----
ObjectCreate("Market_Price_Label2", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Market_Price_Label2", "Ask " + Market_Price2, FontSize, FontType, FontColor2);
ObjectSet("Market_Price_Label2", OBJPROP_CORNER, WhatCorner);
ObjectSet("Market_Price_Label2", OBJPROP_XDISTANCE, DistFromSide);
ObjectSet("Market_Price_Label2", OBJPROP_YDISTANCE, YInitialDistance);
ObjectCreate("Market_Price_Label", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Market_Price_Label", "Bid " + Market_Price, FontSize, FontType, FontColor2);
ObjectSet("Market_Price_Label", OBJPROP_CORNER, WhatCorner);
ObjectSet("Market_Price_Label", OBJPROP_XDISTANCE, DistFromSide);
ObjectSet("Market_Price_Label", OBJPROP_YDISTANCE, Ydist01);
ObjectCreate("Market_Price_Label3", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Market_Price_Label3","Spread " + Market_Spread, FontSize, FontType, Green);
ObjectSet("Market_Price_Label3", OBJPROP_CORNER, WhatCorner);
ObjectSet("Market_Price_Label3", OBJPROP_XDISTANCE, DistFromSide);
ObjectSet("Market_Price_Label3", OBJPROP_YDISTANCE, Ydist02);
ObjectCreate("Daily_Open_Label", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Daily_Open_Label","Daily " + DOpen, FontSize, FontType, Green);
ObjectSet("Daily_Open_Label", OBJPROP_CORNER, WhatCorner);
ObjectSet("Daily_Open_Label", OBJPROP_XDISTANCE, DistFromSide);
ObjectSet("Daily_Open_Label", OBJPROP_YDISTANCE, Ydist03);
ObjectCreate("Weekly_Open_Label", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Weekly_Open_Label","Weekly " + WOpen, FontSize, FontType, Green);
ObjectSet("Weekly_Open_Label", OBJPROP_CORNER, WhatCorner);
ObjectSet("Weekly_Open_Label", OBJPROP_XDISTANCE, DistFromSide);
ObjectSet("Weekly_Open_Label", OBJPROP_YDISTANCE, Ydist04);
//----
//return(0);
}
//+------------------------------------------------------------------+
Comments