PDA

View Full Version : DrawRay


nigeleyre
09-19-2009, 04:23 PM
If I have drawn a DrawRay() line, is it possible to check if the GetCurrentAsk() has crossed that line?

Or is there any other way to check if the price crosses a trend line?

Thank you.

NinjaTrader_Austin
09-20-2009, 02:10 PM
Hi nigeleyre, unfortunately there isn't a NinjaScript method that would accomplish this.

A way to do this would be to create a slope and intercept from the ray's data (y = mx + b) and checking the value every bar and then comparing that value to GetCurrentAsk().

nigeleyre
09-21-2009, 06:36 AM
Thank you, do you have any sample code for this, I'm not quite sure what you mean by (y = mx + b)? It would be most helpfull if you do?

Many thanks,

NIgel.

NinjaTrader_Josh
09-21-2009, 07:17 AM
nigel,

To clarify, Austin is saying the only way you can check against the Ray is if you actually did your own calculations to know where the Ray's value is at each point because you can't access the values of it from code. The only way for you to know the values is if you calculated it by hand through the equation for a line.