Time coordinate error (in Pitchfork object)

 

I have used Pitchfork coordinates to calculate the middle point (4) of the 2-3 leg. Th code is simple:

t1 = ObjectGet(name, OBJPROP_TIME1);
p1 = ObjectGet(name, OBJPROP_PRICE1);
t2 = ObjectGet(name, OBJPROP_TIME2);
p2 = ObjectGet(name, OBJPROP_PRICE2);
t3 = ObjectGet(name, OBJPROP_TIME3);
p3 = ObjectGet(name, OBJPROP_PRICE3);

t4 = (t2 + t3)/2;
p4 = (p2 + p3)/2;

All variables are declared as double.

I am drawing the red lines that start from the desired points: 2, 3, 4.

On the first image red lines are ok but when I move the point 2 a little (second image) the time coordinate of point 4 is incorrect.

Do you have any idea what is the reason of this inaccuracy?





cornelius

 
cornelius:

I have used Pitchfork coordinates to calculate the middle point (4) of the 2-3 leg. Th code is simple:

t1 = ObjectGet(name, OBJPROP_TIME1);
p1 = ObjectGet(name, OBJPROP_PRICE1);
t2 = ObjectGet(name, OBJPROP_TIME2);
p2 = ObjectGet(name, OBJPROP_PRICE2);
t3 = ObjectGet(name, OBJPROP_TIME3);
p3 = ObjectGet(name, OBJPROP_PRICE3);

t4 = (t2 + t3)/2;
p4 = (p2 + p3)/2;

All variables are declared as double.

I am drawing the red lines that start from the desired points: 2, 3, 4.

On the first image red lines are ok but when I move the point 2 a little (second image) the time coordinate of point 4 is incorrect.

Do you have any idea what is the reason of this inaccuracy?





cornelius

No ideas why it is that?

Try to draw any trend line object, calculate its middle point and find it's time coordinate on the screen...

Reason: