OK, since we are a full service forum (gaheitman wrote:Yep, the intersection of the two lines occurs below 32, but we can't read that value since it is between candles. We see the two values before and the two values after. We can tell they cross since on the last bar the red line was above the green line and that is now reversed on the new bar.mobthehop wrote:Guys....embarrased mmmhhhhh....
Well, the way I use this indicator and cross signal, which might NOT be as it was intended:
1. As per image posted by George, the cross happens at a value <32
That's why I wanted to know which of the readable values you wanted below 32.
For the curious:
Code: Select all
//Calculate the point of intersection between two line segments on adjacent candles - gah
//Line Segment 1: (x1,y1), (x2,y2)
//Line Segment 2: (x3,y3), (x4,y4)
//from http://paulbourke.net/geometry/lineline2d/
//Used general case formula for illustrative purposes, despite assumption that
// x1 and x3 are at the origin, and x2 and x4 are at 1
double CalcYIntersection(double y1,double y2,double y3,double y4) {
double ua = ((1 - 0)*(y1 - y3) - (y4 - y3)*(0 - 0)) /
((y4 - y3)*(1 - 0) - (1 - 0)*(y2 - y1));
return(y1 + ua*(y2-y1));
}
Enjoy.
George