Detecting if between trend lines

 
Hi

I would like to know how it is possible to know if price is between two trend lines.

l1 = NormalizeDouble(ObjectGetValueByShift(1TrendName, 0), Digits);
l2 = NormalizeDouble(ObjectGetValueByShift(2TrendName,0),Digits);

if(Ask>l1 && Ask<l2)

This wont work if the two trendlines are at an angle.
Anyone know of a way todo this?

L.
 

if((Ask>l1 && Ask<l2) || (Ask>l2 && Ask<l1))

Also i doubt need of NormalizeDouble

 
Like I said before that wont work if the lines are on an angle.
Say if two lines are parallel two each other and they are at an 45 degree angle , even if the price is outside the the two lines it will still say true.
I think I have to use this too ObjectGetShiftByValue
 
What I did before was try to detect if a price hits a trendline but that didnt want to work.

if(Bid == l1)

I saw the price hitting that line many times but nothing happens.
 

try something like this:

if( Bid > lineValue-0.5*Point && Bid < lineValue+0.5*Point)

This gives a 1 pip range as a target, instead of an "equals" condition.

----

Use ObjectGetValueByShift() to get the value of a trendline at any specifed bar.

 
Thank you Phy!
 
Price could still "hop over" your range, I'd probably use if(Bid >= upperLineValue) for the "hit" test
Reason: