The missing 'crossing'-link

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
Hello esteemed panel,

I have been using 'crosses above' and 'crosses below' extensively, but they only allow to check for a cross against a value that is already known on the DatasSeries (e.g. an EMA that is calculated for each bar).
MotiveWave seems to lack a way to check whether price crosses a trendline that has been drawn X bars in the past (since the current location / value of that line, the one at the CURRENT bar is not known), and I am looking for a way to resolve that issue.
On a sidenote: this can probably also be resolved with a Java library for Euclidian math, but I would like to stay 'closer to home' :)


I am about to start experimenting with 'crosses a trendline´, and I was browsing through the SDK overview to see what classes and methods I could use.

I came a-cross (see what I did there ? :geek:) 'intersection':

1631262880278.png
(the idea would be to 'draw' two lines: the trendline and a vertical line from BarHigh to BarLow, and see if they intersect)

and across 'distanceFromLine':

1631262957887.png
(the idea here would be to check if the distance from the trendline to the PriceBar equals 0; if so, we have a 'cross')


I am about to start code-experiments to see if I can use one of those to check whether price crosses an already drawn trendline, but I was wondering if there are colleague-coders among you who have tackled the same problem and want to warn me about possible pitfalls and / or give clues to jumpstart my experiment. Are any of the above useful ? Is there a better way ? Did you perhaps write an extra class that does exactly this ? ... ?

As always: muchos gracias !!
 
Top