# Which is the best way to detect if the price has touched a trend line?

1019
2013.12.12 20:14
Which is the best way to detect if the price has touched or crossed a trend line
14514
2013.12.12 21:01
How do you think? For position=trendline start to threadline end (iBarShift) get trendline position (ObjectGetValueByShift) touched = H >= positiion & positiion >= L. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Moderator
30737
2013.12.12 21:18
tonny:
Which is the best way to detect if the price has touched or crossed a trend line

if(previous_price<previous_trendline_value and price>=trendline_value

or

previous_price>previous_trendline_value and price<=trendline_value)

then

you have a touch or a cross

Previous can be previous tick, previous bar's high/low...

1019
2013.12.13 07:18
WHRoeder:
How do you think? For position=trendline start to threadline end (iBarShift) get trendline position (ObjectGetValueByShift) touched = H >= positiion & positiion >= L. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.

angevoyageur:

if(previous_price<previous_trendline_value and price>=trendline_value

or

previous_price>previous_trendline_value and price<=trendline_value)

then

you have a touch or a cross

Previous can be previous tick, previous bar's high/low...

Thanks angevoyageur that i know. Its the part for getting trendline_value for the bars that is a challenge like if it were low price we just use Low[...] or iLow(...). Is there such a function for trendline or maybe can it be drawn using a buffer?

1019
2013.12.13 07:41
Ive found this. https://docs.mql4.com/objects/objectgetvaluebyshift . I think its a possible solution. Thanks WHroeder for that bit but don't be rude to forum users im a coder too but its long since i read book and iv'e never done trendline before.
6315
2013.12.13 08:59
tonny:
Ive found this. https://docs.mql4.com/objects/objectgetvaluebyshift . I think its a possible solution. Thanks WHroeder for that bit but don't be rude to forum users im a coder too but its long since i read book and iv'e never done trendline before.

bravo, ....
WHRoeder:
How do you think? For position=trendline start to threadline end (iBarShift) get trendline position (ObjectGetValueByShift) touched = H >= positiion & positiion >= L. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.

that was big help it isn't rude to say this, you didn't show any attempt how you tried

you had to ask also for how do i get trendline value you didn't and WHRoeder did already

1019
2013.12.13 09:26
deVries:

bravo, ....

that was big help it isn't rude to say this, you didn't show any attempt how you tried

you had to ask also for how do i get trendline value you didn't and WHRoeder did already

I didnt post code because its only the trendline value that was challenging so it wasnt necessary to post the entire code as i know how to work with it after i extract it thanks all for helping.
14514
2013.12.13 13:39
tonny:
WHRoeder:
How do you think? For position=trendline start to threadline end (iBarShift) get trendline position (ObjectGetValueByShift) touched = H >= positiion & positiion >= L. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Thanks angevoyageur that i know. Its the part for getting trendline_value for the bars that is a challenge like if it were low price we just use Low[...] or iLow(...). Is there such a function for trendline or maybe can it be drawn using a buffer?
It's to bad you are hard of reading. And for someone that has been on this site for THREE years you really do need to RTFM
1019
2013.12.15 14:39
WHRoeder:
It's to bad you are hard of reading. And for someone that has been on this site for THREE years you really do need to RTFM
This topic is over.