bspread_
Download scriptThis script is designed as a specialized visual aid for MetaTrader users who need to monitor real-time trading costs directly on their main chart screen. Instead of forcing you to look away from the price action to check your broker's current conditions, it pulls that specific data and displays it as a clear, readable text label.
Core Functionality
The primary purpose of this tool is to track the Spread—the difference between the buying and selling price of a currency or asset—and display it instantly. Because the spread can fluctuate based on market volatility and liquidity, this script ensures that you always have an up-to-date "live" look at what it currently costs to enter a trade.
How it Works
- Dynamic Data Retrieval: The script constantly communicates with your broker's data feed to fetch the current market spread for the specific asset you are viewing. It takes this raw number and rounds it to one decimal place to keep the display clean and easy to read at a glance.
- Visual Customization: You have full control over how this information appears on your screen. The script allows you to choose:
- Screen Position: You can decide whether the information appears in the top-right, bottom-left, bottom-right, or top-left corner of your chart.
- Styling: You can customize the font type (such as Tahoma), the text size, and the color (e.g., Red) to ensure the information stands out against your background.
- Automated Management: The script is designed to be "set and forget." It automatically creates the text label when you load the indicator and properly removes it from the chart when you close it, ensuring that no leftover graphics clutter your workspace.
User Experience
Essentially, this tool acts as a dedicated dashboard widget. It simplifies your trading workflow by consolidating vital broker information into a customizable on-screen display, allowing for faster decision-making without needing to navigate through different windows or menus.
//+-------------------------------------------------------------------+
//| BSpread.mq4 |
//| Morteza Yaghmouri |
//| http://www.btrend.ir |
//+-------------------------------------------------------------------+
#property copyright "2016 , Morteza Yaghmouri"
#property link "http://www.btrend.ir"
#property version "1.0"
#property strict
#property indicator_chart_window
//+------------------------------------------------------------------+
//| indicator Properties |
//+------------------------------------------------------------------+
extern string PartA="# Location settings ";
extern int Location=4; // Indicator location on chart
extern string Location_tips=" 1 : top-right, 2 : botton-left, 3 : botton-right, 4 : top-left"; //location description
extern string PartB="# Font settings ";
extern string Font="Tahoma"; // Indicator font
extern color Color=Red; // Indicator color
extern int Size=10; // Indicator font size
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if(Location!=0)
{
ObjectCreate("bspread",OBJ_LABEL,0,0,0);
ObjectSet("bspread",OBJPROP_CORNER,Location);
ObjectSet("bspread",OBJPROP_XDISTANCE,7);
ObjectSet("bspread",OBJPROP_YDISTANCE,12);
}
return(0);
}
//+------------------------------------------------------------------+
//| indicator Delete function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("bspread");
return(0);
}
//+------------------------------------------------------------------+
//| indicator Create function |
//+------------------------------------------------------------------+
int start()
{
ObjectSetText("bspread","Spread : "+DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),1),Size,Font,Color);
return(0);
}
//+------------------------------------------------------------------+
Comments