Download MetaTrader 5
To add comments, please log in or register
MQL5.community allows users to store their source codes in MQL5 Storage. Try it!
Line_Trader
9
Line_Trader 2016.08.29 07:52 

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);
Keith Watford
Moderator
7909
Keith Watford 2016.08.29 09:42  
Use a rectangle label, you can set the Y size to 1 or 2 pixels
whroeder1
13617
whroeder1 2016.08.29 12:32  
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.
/
To add comments, please log in or register