OBJ_TRENDBYANGLE quick question

 

Hi,

 

I haven't look into this yet because I dont have time at this moment. I got the lates 3 price rates and use the 2 oldest ones to draw the trend line. I need to get the price value of the trendline crossing the new bar (busy forming by market ticks). Is this possible?

 

Here is some of my code just fro what it is worth, at the bottom I added some test to explain what I need..

 

int window = ObjectFind(ChartID(),CloseName);
         if(window<0)
            {
               ObjectCreate(ChartID(),CloseName,OBJ_TRENDBYANGLE,0,rates[0].time,rates[0].high,rates[1].time,rates[1].high);
            }
            else
            {
               ObjectSetInteger(ChartID(),CloseName,OBJPROP_TIME,0,rates[0].time);
               ObjectSetDouble(ChartID(),CloseName,OBJPROP_PRICE,0,rates[0].high);
               ObjectSetInteger(ChartID(),CloseName,OBJPROP_TIME,1,rates[1].time);
               ObjectSetDouble(ChartID(),CloseName,OBJPROP_PRICE,1,rates[1].high);
            }
            double angle = 0.0;
            ObjectGetDouble(ChartID(),CloseName,OBJPROP_ANGLE,0,angle);
            StopPoint =  ObjectGetDouble("I NEED THIS CODE HERE, WHAT PROPERTY TO USE??? for reates[3].time");
            int stop =0; 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Types - Documentation on MQL5
 

I managed to find what i was looking for

double ObjectGetValueByTime(
long chart_id, // chart identifier
string name, // object name
datetime time, // Time
int line_id // Line number
);

I honestly cant grasp the meaning of the line_id parameter? does anyone know?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Properties - Documentation on MQL5
 
ToolMaker:

I honestly cant grasp the meaning of the line_id parameter? does anyone know?

There is note for this function:

Note

An object can have several values in one price coordinate, therefore it is necessary to specify the line number. 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
  • Liner regression channel (OBJ_REGRESSION) - 3 lines
  • Standard deviation channel (OBJ_STDDEVCHANNEL) - 3 lines
  • Arrowed line (OBJ_ARROWED_LINE)