actual price where lines intersect - page 2

 
SDC:

12x + 13278 = 23.25x + 13192

put all the x stuff on the left side

12x + 23.25x = 1.3278 + 1.3192

You made a mistake there. It should be:

12x - 23.25x = 1.3192 - 1.3278

 
xorpheus:

You made a mistake there. It should be:

12x - 23.25x = 1.3192 - 1.3278

yes i forgot all about reversing the signs, my old math teacher would turn in her grave lol, but it still wouldnt work the value of x should be about 7 but I am going to have another look at my second attempt I didnt reverse the signs that time either.

I read over your example, im going to try it that way later, but what happened to y1 = a1x + b1 ? Also why can we not use prices ? Surely the price is a valid y axis to work with ?

 
SDC:

I read over your example, im going to try it that way later, but what happened to y1 = a1x + b1 ? Also why can we not use prices ? Surely the price is a valid y axis to work with ?


That's exactly what I did do: y axis is price, x axis is bar count (or time if you like). For working out the intersection of lines, each point has both x and y coordinates. The initial problem is a special case where we have two points with a common x value (first bar) and another two points with a common x value (second bar) that must be different to the first bar x value. We only wanted the price (y coordinate) of the intersection point so x could be completely eliminated from the final equation. You plug in your four prices and get one price as the answer.

Have a look at this:
http://www.mathopenref.com/coordintersection.html

There will be a far more eloquent way of writing it than the way I did. Perhaps instead of p1....p4 I should have used t1p1 t1p2 t2p1 t2p2, with t1 representing the first trendline and t2 the second. That way it would be clearer which values go where in the final equation. It is much easier to explain using actual numbers but by only using variables you now have an equation to put into your MQL4 code :)

 

I looked at what you did, theres a few things at first glance I still have a probem with, having said that I worked all day I am probably too tired for mental excersices lol, I'll look at it again in the morning, but anyway aside from that did you try your equation with real chart prices and real trendline parameters to see if it works ?

 
SDC:

I looked at what you did, theres a few things at first glance I still have a probem with, having said that I worked all day I am probably too tired for mental excersices lol, I'll look at it again in the morning, but anyway aside from that did you try your equation with real chart prices and real trendline parameters to see if it works ?


No, but I did check a couple of obvious cases like where one of the lines is horizontal etc. Keep in mind that this only works accurately with straight lines.