Author: Copyright � 2010, 2010, Elmare
A_Stops

This script is designed as a visual aid for traders using the MetaTrader platform to help them monitor specific price levels automatically. Its primary purpose is to project horizontal lines on your trading chart that represent potential "stop" levels based on a set distance from the current market price.

How it Works

The tool operates by identifying the most recent closing price of the market and calculating two different sets of boundaries around that price point. It then draws four distinct horizontal lines on your screen to visualize these zones:

1. The Primary Boundaries (Outer Range) The script creates a set of outer limits based on a larger, customizable distance (the first "stops" setting).

  • One line is projected above the current price.
  • One line is projected below the current price. These lines help you visualize a broader range of movement or a wider protection zone.

2. The Secondary Boundaries (Inner Range) The script also creates a second set of lines based on a smaller, more immediate distance (the "stops2" setting).

  • One line is projected above the current price.
  • One line is projected below the current price. These act as tighter visual markers, allowing you to see closer-range price levels at a glance.

Key Features for the User

  • Dynamic Updating: The lines are not static; they move automatically with the market. As each new price candle closes, the script recalculates the positions and shifts the lines to remain perfectly aligned with the latest data.
  • Visual Customization: You can personalize how these markers appear on your chart. The script allows you to adjust the colors and line styles (such as making them solid, dashed, or dotted) so they fit seamlessly with your existing visual setup.
  • Automatic Management: The script handles all the "heavy lifting" of creating and deleting these lines. When you activate the indicator, it builds the markers on your chart; when you remove it, it automatically cleans up the chart by deleting them for you.

Summary of Benefit

Essentially, this tool removes the need to manually calculate and draw horizontal lines every time the price moves. It provides a constant, real-time visual representation of your target distances, helping you keep track of key price levels while you focus on analyzing the market trends.

10 Views
0 Downloads
0 Favorites
A_Stops
//+------------------------------------------------------------------+
//|                                                      A_stops.mq4 |
//|                                         Copyright © 2010, Elmare |
//|                                        http://elmare.webnode.ru  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, 2010, Elmare"
#property link      "http://elmare.webnode.ru"

#property indicator_chart_window


int tmp;
extern int stops=300;
extern int stops2=100;
extern color cl=DarkSlateGray;
extern color cl2=DarkSlateGray;
extern int style=4;
extern int style2=2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

 


  
  
  
ObjectCreate("aL1",OBJ_HLINE,0,0,0);

ObjectCreate("aL2",OBJ_HLINE,0,0,0);

ObjectCreate("aL21",OBJ_HLINE,0,0,0);

ObjectCreate("aL22",OBJ_HLINE,0,0,0);


//-------------------------------


   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
ObjectDelete("aL1"); 
ObjectDelete("aL2");
ObjectDelete("aL21"); 
ObjectDelete("aL22");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   
 if (ObjectFind("aL1")==-1) ObjectCreate("aL1",OBJ_HLINE,0,0,0);
 if (ObjectFind("aL2")==-1) ObjectCreate("aL2",OBJ_HLINE,0,0,0);
 if (ObjectFind("aL21")==-1) ObjectCreate("aL21",OBJ_HLINE,0,0,0);
 if (ObjectFind("aL22")==-1) ObjectCreate("aL22",OBJ_HLINE,0,0,0);
//----

 
   
//----------------------------   
ObjectSet("aL1",OBJPROP_TIME1,Time[0]); 
ObjectSet("aL1",OBJPROP_PRICE1,Close[0]+stops*Point); 
ObjectSet("aL1",OBJPROP_COLOR,cl);
ObjectSet("aL1",OBJPROP_STYLE,style);

ObjectSet("aL2",OBJPROP_TIME1,Time[0]); 
ObjectSet("aL2",OBJPROP_PRICE1,Close[0]-stops*Point); 
ObjectSet("aL2",OBJPROP_COLOR,cl);
ObjectSet("aL2",OBJPROP_STYLE,style); 

ObjectSet("aL21",OBJPROP_TIME1,Time[0]); 
ObjectSet("aL21",OBJPROP_PRICE1,Close[0]+stops2*Point); 
ObjectSet("aL21",OBJPROP_COLOR,cl2);
ObjectSet("aL21",OBJPROP_STYLE,style2);

ObjectSet("aL22",OBJPROP_TIME1,Time[0]); 
ObjectSet("aL22",OBJPROP_PRICE1,Close[0]-stops2*Point); 
ObjectSet("aL22",OBJPROP_COLOR,cl2);
ObjectSet("aL22",OBJPROP_STYLE,style2);

   return(0);
  }
//+------------------------------------------------------------------+

Comments