Download MetaTrader 5

find the position of a vertical line

To add comments, please log in or register
florenceale
137
florenceale  

Hi,

my graph draws a series of vertical lines following specific indicators.

If i want to check the position of the last i have found this function


datetime  ObjectGetTimeByValue(
   long     chart_id,      // chart ID
   string   object_name,   // object name
   double   value,         // price
   int      line_id=0      // line identifier
   );


but i dont have any price for vertical lines...wich function is better to use and what do i write there if this one is right?

florenceale
137
florenceale  

maybe it is better this, just need to know the name of the object.

double  ObjectGet(
   string   object_name,   // object name
   int      index          // object property
   );
florenceale
137
florenceale  
string t_lineav =  TimeToString(ObjectGet("Vline_giu1", OBJPROP_TIME1),TIME_DATE|TIME_MINUTES);

done in this way and it works, thanks anyways.

whroeder1
16764
whroeder1  
florenceale: If i want to check the position of the last i have found this function
ObjectGetTimeByValue
Perhaps you should read the manual. ObjectGetTimeByValue - Object Functions - MQL4 Reference explicitly states:
This function applies only to the following objects:

    Trendline (OBJ_TREND)
    Trendline by angle (OBJ_TRENDBYANGLE)
    Gann line (OBJ_GANNLINE)
    Equidistant channel (OBJ_CHANNEL) - 2 lines
    Linear regression channel (OBJ_REGRESSION) - 3 lines
    Standard deviation channel (OBJ_STDDEVCHANNEL) - 3 lines

Like wise:
           ObjectGetValueByTime - Object Functions - MQL4 Reference
           ObjectGetShiftByValue - Object Functions - MQL4 Reference
           ObjectGetValueByShift - Object Functions - MQL4 Reference

Your vertical line has just one value (Time1.) Just get it.

To add comments, please log in or register