ObjectGet not getting the angle value of a trend line

 

hello, i wanted to draw a trend line programmatically, and get the angle value of the trend line. here is my code.


   ObjectDelete("angle");
   ObjectCreate("angle",OBJ_TRENDBYANGLE,0,iTime(NULL,0,5),High[5],iTime(NULL,0,1),High[1]);
   ObjectSet("angle", OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet("angle", OBJPROP_COLOR, Red);
   ObjectSet("angle", OBJPROP_WIDTH, 0);

double angle = ObjectGet("angle", OBJPROP_ANGLE);
Print(angle);


but i am unable to get the angle value. it returns always 0. i have tried with "OBJPROP_COLOR" it returns value. But when I try with "OBJPROP_ANGLE" it did not return anything.

how can i get the angle value of the trend line?

Please help.

 
sourav2452: and get the angle value of the trend line.
Can't be done.
  1. There is no angle from 2 anchor points. An angle requires distance divided by distance; a unit-less number. A chart has price and time. What is the angle of going 30 miles in 45 minutes? Meaningless!

  2. You can get the slope from a trendline: m=ΔPrice÷ΔTime. Changing the price scale, bar width, or window size, changes the apparent angle, the slope is constant. Angle is meaningless.

  3. You can create an angled line using one point and setting the angle (Object Properties - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference.) The line is drawn that angle in pixels. Changing the axes scales does NOT change the angle (and thus is meaningless.)

  4. If you insist, take the two price/time coordinates, convert them to pixel coordinates and then to apparent angle with arctan.
              How to get the angle of a trendline and place a text object to it? - Trend Indicators - MQL4 programming forum - Page 2

Reason: