NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-28-2008, 01:49 PM   #1
cassb
Senior Member
 
Join Date: Nov 2007
Location: Victor, NY
Posts: 577
Thanks: 5
Thanked 4 times in 4 posts
Send a message via Yahoo to cassb Send a message via Skype™ to cassb
Default DrawRay() and the *next* bar

Let's say I use DrawRay() to draw a ray from Open[2] to Open[1]. Is there a way to tell when the CurrentBar closes if Open[0] is above or below the extended ray? I guess I would need to know the price where the ray would intersect each future bar.

Thanks!
Bryan
Price-Dynamics.com
A NinjaTrader Official Partner

Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy!

Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account!
cassb is offline  
Reply With Quote
Old 08-28-2008, 02:11 PM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Yes, this is possible with some advanced programming. For an example, look at the code in the Automatic Trend Line indicator at this link:
http://www.ninjatrader-support.com/v...ks.php?catid=1
NinjaTrader_Ben is offline  
Reply With Quote
Old 08-28-2008, 02:42 PM   #3
cassb
Senior Member
 
Join Date: Nov 2007
Location: Victor, NY
Posts: 577
Thanks: 5
Thanked 4 times in 4 posts
Send a message via Yahoo to cassb Send a message via Skype™ to cassb
Default

Quote:
Originally Posted by NinjaTrader_Ben View Post
Yes, this is possible with some advanced programming. For an example, look at the code in the Automatic Trend Line indicator at this link:
http://www.ninjatrader-support.com/v...ks.php?catid=1
Well that's funny, because that's the code that I was modifying! :-)

Ok, so where in that code is it determining what the value of the extended ray is -- when it's finding out whether the trendline has been crossed?
Price-Dynamics.com
A NinjaTrader Official Partner

Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy!

Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account!
cassb is offline  
Reply With Quote
Old 08-28-2008, 03:04 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

In the code there are comments, something like "Check for trend line break" etc...This is from memory. You will have to rip through the code to understand what is happening. In a nutshell, it grabs the xy values of the start and end point of the trend line and calculates the slope (change per bar) and then add this to each subsequent bar to determine the line value which then can be checked against the close price etc...
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-28-2008, 06:49 PM   #5
cassb
Senior Member
 
Join Date: Nov 2007
Location: Victor, NY
Posts: 577
Thanks: 5
Thanked 4 times in 4 posts
Send a message via Yahoo to cassb Send a message via Skype™ to cassb
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
In the code there are comments, something like "Check for trend line break" etc...This is from memory. You will have to rip through the code to understand what is happening. In a nutshell, it grabs the xy values of the start and end point of the trend line and calculates the slope (change per bar) and then add this to each subsequent bar to determine the line value which then can be checked against the close price etc...
Yes, thank you, that's what I thought too. Now where are those old geometry books... ;-)

Bryan
Price-Dynamics.com
A NinjaTrader Official Partner

Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy!

Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account!
cassb is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get DrawRay() Line Object Properties phylum General Programming 3 06-04-2008 11:33 PM


All times are GMT -6. The time now is 10:30 AM.