Horizontal line at height not depending on price

 

How to draw a horizontal line on a MT4 chart without taking quotes into account? So the markets can move but the line stays at same height. I want to make a scatter plot within a MT4 chart and this should stay fixed on the chart, not move with the quotes.  

By using this code it moves with the quotes: 

ObjectCreate( "XLine", OBJ_HLINE, 0, Time[0], Bid );  

 

Why can't it be done like this:

   ObjectCreate("XLine",OBJ_HLINE,0,Time[0],0);
   ObjectSet("XLine",OBJPROP_YDISTANCE,40);
 
Use a rectangle label, you can set the Y size to 1 or 2 pixels
 
Line_Trader:

How to draw a horizontal line on a MT4 chart without taking quotes into account? So the markets can move but the line stays at same height.

I want to make a scatter plot within a MT4 chart and this should stay fixed on the chart, not move with the quotes.  

By using this code it moves with the quotes:

ObjectCreate( "XLine", OBJ_HLINE, 0, Time[0], Bid );  
  1. Once you create the HLINE it is done. Calling ObjectCreate again fails (the object already exists.) The line is always at the "same height," it does not "move with quotes." You must be deleting the line and recreating it.
  2. You must use different names for different objects.
Reason: