Hi
Is there any formula for finding whether two trend lines are parallel? I am finding the slope of first trend line and matching with the other, but it is not accurate.
Any other guidelines please.
Thanks.
richo.
I would think that it is quite rare to find 2 trendlines truly parallel unless they have been drawn that way on purpose.
Find the TL that spans the shortest length of time, find the difference in price between the start and the end,
Check that the other trendline moves bythr same amount pricewise in the same timespan. Then they are parallel. But I think that you would have to allow a bit of margin.
I would think that it is quite rare to find 2 trendlines truly parallel unless they have been drawn that way on purpose.
Find the TL that spans the shortest length of time, find the difference in price between the start and the end,
Check that the other trendline moves bythr same amount pricewise in the same timespan. Then they are parallel. But I think that you would have to allow a bit of margin.
Hi GumRai
Thanks. I am working on it, as you said we have to allow deviation plus or minus some points.
double slope1 = ..., slope2 = ..., epsilon = MathMax( MathAbs(slope1), MathAbs(slope2) ) * 0.001; bool parallel = MathAbs(slope1 - slope2) < epsilon;
Thanks a Lot.
I think is bettter ...
follow:
//+------------------------------------------------------------------+
//| right comparison of 2 doubles |
//+------------------------------------------------------------------+
//--- normalize difference between expression1 : expression2 : expression..n
double true_diff = (expression1==expression2)?0:(expression1-expression 2)/(expression2-expression1);
I wrong ?!
....
Thanks !
I think is bettter ...
follow:
//+------------------------------------------------------------------+
//| right comparison of 2 doubles |
//+------------------------------------------------------------------+
//--- normalize difference between expression1 : expression2 : expression..n
double true_diff = (expression1==expression2)?0:(expression1-expression 2)/(expression2-expression1);
I wrong ?!
....
Thanks !
Hello,
Please use the SRC button when you post code. Thank you.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
Is there any formula for finding whether two trend lines are parallel? I am finding the slope of first trend line and matching with the other, but it is not accurate.
Any other guidelines please.
Thanks.
richo.