How to test if Candle’s open/close straddles a horizontal Trend Line.
-
Hello,
Upon certain conditions my EA draws horizontal Trend Lines (left to right) on my chart, which are given Object Names “Buy Line” & “Sell Line”.
There can be many horizontal Trend Lines drawn in a typical day.
-
I need to be able to test for if a Candle Opens below, then closes above the same “Buy Line”.
-
I need to be able to test for if a Candle Opens above, then closes below the same “Sell Line”.
I cannot work out how to refer to the “Buy Line” or “Sell Line” objects and its accompanying Price value in a Condition block.
Regards
-
-
Go here https://fxdreema.com/examples/ and find those examples whose names start with "Get chart object's attribute...".
Note that you can only have 1 object with name "Buy line", because what makes objects unique is their name, they are indexed by their name.
-
Hello,
Thanks very much. I think I got the hang of it. The example code below seems to be working.

......
Trendlines.jpg