spread_stoplevel_info_alert_en

Download script
Author: Yuriy Tokman
spread_stoplevel_info_alert_en

This tool is designed to provide traders with real-time visual monitoring of two critical market environment variables: the Spread and the Stop Level. By displaying these figures directly on your trading chart, it helps you stay aware of immediate market conditions that can affect order execution.

Key Functions and Logic

1. Dynamic Market Monitoring The script continuously scans the live market data for the specific currency pair or asset you are currently viewing. It specifically tracks:

  • Spread: The difference between the current bid and ask prices.
  • Stop Level: The minimum distance required from the market price where stop orders can be placed.

2. Visual Alerts and Notifications The tool distinguishes between "stable" market conditions and "active changes":

  • Change Detection: If the Spread or Stop Level fluctuates, the text on your chart will change color (typically to Red) to grab your attention immediately.
  • Audio/Popup Alerts: You can enable a notification system that triggers an alert every time a change occurs. This ensures you don't miss sudden spikes in costs or restrictions on where you can place your protective orders.
  • Status Confirmation: When the market values remain steady, the display changes to a different color (typically Lime/Green), providing a clear "all-clear" visual cue.

3. On-Screen Display Instead of requiring you to navigate through different menus or windows, the script creates a dedicated text area on your main chart window. It automatically calculates the positioning so that the data remains visible and readable without obstructing your technical analysis.

Summary for the Trader

Think of this as a "live dashboard" for market friction. It tells you exactly how much it costs to enter a trade right now and where the broker allows you to place your limits. By highlighting changes in color and providing alerts, it acts as an early warning system for volatile shifts in trading costs or liquidity.

Miscellaneous
It issuies visual alerts to the screen
8 Views
0 Downloads
0 Favorites
spread_stoplevel_info_alert_en
//+------------------------------------------------------------------+
//|                                              Ñïðåä_Ñòîïëåâåë.mq4 |
//|                                                     Tokman Yuriy |
//|  5 ÿíâàðÿ 2009 ãîäà                     yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link      "yuriytokman@gmail.com"

#property indicator_chart_window

extern bool Play = true;

extern color color1 = Red;
extern color color2 = Lime;
extern int FontSise = 12;

int SPREAD_prev;
int STOPLEVEL_prev;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   ObjectCreate("sigl",OBJ_LABEL,0,0,0,0,0);
   ObjectCreate("sigl2",OBJ_LABEL,0,0,0,0,0);
   ObjectCreate("sig2",OBJ_LABEL,0,0,0,0,0);
   ObjectCreate("sig22",OBJ_LABEL,0,0,0,0,0);   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete ("sigl");
   ObjectDelete ("sigl2");
   ObjectDelete ("sig2");
   ObjectDelete ("sig22");   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    double SPREAD=MarketInfo( Symbol(), MODE_SPREAD),d;
    int STOPLEVEL=MarketInfo( Symbol(), MODE_STOPLEVEL),d2;

    d=SPREAD-SPREAD_prev;
    d2=STOPLEVEL-STOPLEVEL_prev;
//////////////////////////////////////ñïðåä////////////////////////   
    string name= "SPREAD: ";
    string par = DoubleToStr(SPREAD,2);
    
    if     (d!=0)  
    {
     ObjectSetText("sigl",name,FontSise,"Arial Black",color1);
     ObjectSetText("sigl2",par,FontSise,"Arial Black",color1);
     if ( Play == true)Alert("Symbol: ",Symbol(),";"," Spread changed: ",SPREAD);

    }
    else if(d==0)  
    {
     ObjectSetText("sigl",name,FontSise,"Arial Black",color2);
     ObjectSetText("sigl2",par,FontSise,"Arial Black",color2);
    }
    
   ObjectSet("sigl",OBJPROP_XDISTANCE,3);
   ObjectSet("sigl2",OBJPROP_XDISTANCE,30+FontSise*8);
 
   ObjectSet("sigl",OBJPROP_YDISTANCE,30);
   ObjectSet("sigl2",OBJPROP_YDISTANCE,30);
   
   SPREAD_prev=SPREAD;
//////////////////////////////////////////////////////////////////
///////////////////ñòîïëåâåë/////////////////////////////////////
    string name2= "STOPLEVEL: ";
    string par2 = DoubleToStr(STOPLEVEL,0);
    
    if     (d2!=0)  
    {
     ObjectSetText("sig2",name2,FontSise,"Arial Black",color1);
     ObjectSetText("sig22",par2,FontSise,"Arial Black",color1);
     if ( Play == true)Alert("Symbol: ",Symbol(),";"," Stoplevel changed: ",STOPLEVEL);
    }
    else if(d2==0)  
    {
     ObjectSetText("sig2",name2,FontSise,"Arial Black",color2);
     ObjectSetText("sig22",par2,FontSise,"Arial Black",color2);
    }
    
   ObjectSet("sig2",OBJPROP_XDISTANCE,3);
   ObjectSet("sig22",OBJPROP_XDISTANCE,30+FontSise*8);
 
   ObjectSet("sig2",OBJPROP_YDISTANCE,50);
   ObjectSet("sig22",OBJPROP_YDISTANCE,50);
   
   STOPLEVEL_prev=STOPLEVEL;
//////////////////////////////////////////////////////////////////                  
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments