Hi MQLers,
I am happy to finally be able to programmatically add trendlines on my charts based on select parameters. However I seem to need help with the next step, which is: how am I able to detect if a trendline is crossed by a candle (or any other symbol)? I suppose I am not able to get the coordinates of the graphical objects so calculating the trendline's slope and then going tick by tick and checking their coords is not a way to go. Or is it? Hope I am wrong in many ways ... Can somebody help, please?
Umm, could you be more specific please? How do I find out if candle 1 touches a trendline?
Umm, could you be more specific please? How do I find out if candle 1 touches a trendline?
if not both values bigger or smaller then trendlinevalue at bar 1 then it has crossed...
how do i find out what you are doing
if not both values bigger or smaller then trendlinevalue at bar 1 then it has crossed...
how do i find out what you are doing
I see ..so it looks like I am still too much of a novice using mql4; e.g. if I add a trendline spanning Time[10] - Time[25], am I able to iterate it as in Trendline[0]. Trendline[2], ... and check the values? If so, then that is exactly what I need..:-)
I see ..so it looks like I am still too much of a novice using mql4; e.g. if I add a trendline spanning Time[10] - Time[25], am I able to iterate it as in Trendline[0]. Trendline[2], ... and check the values? If so, then that is exactly what I need..:-)
Suppose wrong
ObjectGetValueByShift - MQL4 Documentation Look for Low[x]<= VBS(x) <= High(x) where x is between TL start iBarShift( ObjectGet(tl, OBJPROP_TIME1)) and end TIME2, inclusive.
or
ObjectGetShiftByValue - MQL4 Documentation Look for SBV(price) between TL start and end.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 MQLers,
I am happy to finally be able to programmatically add trendlines on my charts based on select parameters. However I seem to need help with the next step, which is: how am I able to detect if a trendline is crossed by a candle (or any other symbol)? I suppose I am not able to get the coordinates of the graphical objects so calculating the trendline's slope and then going tick by tick and checking their coords is not a way to go. Or is it? Hope I am wrong in many ways ... Can somebody help, please?