q-Spread

This tool is designed to provide traders with a clear, real-time visual of the Spread, which is the difference between the price at which you can buy and sell a currency or asset. In trading, monitoring this gap is essential because it represents the transaction cost of every move you make.

How the Logic Works

1. Price Calculation The script constantly monitors the "Ask" price (the price to buy) and the "Bid" price (the price to sell). It subtracts the Bid from the Ask to determine the numerical difference between them.

2. Smart Scaling (Point Adjustment) Because different brokers use different decimal systems (some show more digits than others), the script includes a built-in logic check. If the market has high precision (e.g., 3 or 5 decimal places), the script automatically scales the calculation to ensure the spread is displayed as a standard, readable number rather than an extremely small fraction.

3. Dynamic Visual Display The script is designed to show this information in two ways:

  • Data Feed: It constantly updates a "Comment" on your screen, which acts as a live text feed of the current spread.
  • On-Screen Label: If the primary display settings are enabled, the script creates a large, bold visual label on your chart. This allows you to see the spread clearly at a glance without having to look for small numbers in the market window.

4. Customization The logic allows for personalized viewing preferences. You can choose:

  • Whether to show the large text label or keep it off.
  • The size of the text on your screen.
  • The specific color of the display (e.g., Yellow).
  • The exact coordinates (position) on your chart where you want the spread information to appear.

Summary

Essentially, this script acts as a dedicated monitor. It does the math for you—calculating the spread and adjusting for different broker formats—and then highlights that data directly on your trading screen so you can make faster, more informed decisions regarding transaction costs.

15 Views
0 Downloads
0 Favorites
q-Spread
#property copyright "Copyright © 2010, Arshed Qureshi. ArshadFX" // arshedfx@gmail.com
#property indicator_chart_window
extern bool BigDisplay = 1;
extern int   DisplaySize = 12;
extern color DisplayColor = Yellow;
extern int   Display_y   =10;
extern int   Display_x   =0;

int deinit(){Comment(""); ObjectDelete("sp"); return(0); }

int start()
   {
   double myPoint, Sp;
      
   if(Digits==5||Digits==3) {myPoint=Point*10;} else {myPoint=Point;}
   Sp=(Ask-Bid)/myPoint;
   Comment("Spread = ",Sp);
   if (BigDisplay)
      {
      Comment("");
      ObjectCreate("sp", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("sp","Spread = "+DoubleToStr(Sp,1),DisplaySize, "Arial Bold", DisplayColor);
      ObjectSet("sp", OBJPROP_CORNER, 0);
      ObjectSet("sp", OBJPROP_XDISTANCE, Display_x);
      ObjectSet("sp", OBJPROP_YDISTANCE, Display_y);       
      }
   return(0);
   }



   

Comments