Horizontal line at height not depending on price

Back to topics list To post a new topic, please log in or register
avatar
2
Line_Trader 2016.08.29 09: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);

 

avatar
Moderator
3418
GumRai 2016.08.29 11:42 #
 
Use a rectangle label, you can set the Y size to 1 or 2 pixels
avatar
13004
WHRoeder 2016.08.29 14: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.
Back to topics list  

To add comments, please log in or register