Line coordinates

 
Hello,


Drawing trend lines from code is piece of cake when you specify the time for the two or three points. However this is not practical if you need to know if a point belongs or not to a trendline as well as finding two or more trendlines intersections, the angles between two trendlines and so on...

Let's take for example the creation of two trend lines:

  ObjectCreate("line_1", OBJ_TREND, 0, D'2007.07.23 20:00:00', 106.00, D'2007.07.31 12:00:00', 102.85);
  ObjectSet("line_1", OBJPROP_COLOR, Lime);
 
  ObjectCreate("line_2", OBJ_TREND, 0, D'2007.07.26 12:00:00', 106.69, D'2007.08.01 08:00:00', 99.45);
  ObjectSet("line_2", OBJPROP_COLOR, Aqua);
Is there any way I can use some different coordinate value for OX axis? Using for example double or integer values which can be converted to and from datetime? I am trying to reach the line equation and I cannot figure how to do it with datetime values. When you visually alter a trendline by moving one of the points a tooltip is displayed which shows there is a sort of integer based coordinating system but the origin is considered to be one other point of the same trendline.

Any idea on how I could make use of that integer expression of the datetime value?


Thank you,
Evariste
 
EvaristeGalois7:
Is there any way I can use some different coordinate value for OX axis?
Any idea on how I could make use of that integer expression of the datetime value?

Bar number should do.
It can be found by iBarShift
 
Irtron:
EvaristeGalois7:
Is there any way I can use some different coordinate value for OX axis?
Any idea on how I could make use of that integer expression of the datetime value?

Bar number should do.
It can be found by iBarShift
Didn't consider the index so far; it seems that iBarShift / iTime is exactly what I needed;

Thank you, Irtron, I'm new to the internals of MQL4, but it looks great so far.
Reason: