NinjaTrader Support Forum  

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 01-29-2008, 09:34 AM   #1
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default Calc an angle?

Hi,

I'm trying to write an indicator to figure certain "angles" of lines. I figure if I can draw a line from point "A" to point "B" I should be able to determine the angle (in degrees) from that...unfortunately math/trig isn't my strongpoint.

I've got the following coded and it compiles just fine, but I'm not getting proper output...any input greatly appreciated.


DrawLine("tag1", true, 1, SLOPEREG[1], 0, SLOPEREG[0], Color.LimeGreen, DashStyle.Dot, 2);

CALC = ((SLOPEREG[0] - SLOPEREG[1]) / (CurrentBar - (CurrentBar - 1)));
LANGLE = System.Math.Atan(CALC) * 180 / Math.PI;
Burga1 is offline  
Reply With Quote
Old 01-29-2008, 09:52 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

I recall someone working on the same issue on this forum. Please try search for "angle"
NinjaTrader_Dierk 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
Session times/bar calc nicko9 Market Analyzer 5 05-25-2009 12:55 AM
Slppe/Angle of indicator AO76 Indicator Development 6 07-09-2007 10:22 PM
Trade Angle Strategies Launches Real-time Trading Software on NinjaTrader Platform NinjaTrader_Ray News and Announcements 0 06-20-2007 02:55 PM
Need help with a condition to check the angle of an MA NinjaTrader_Ray Strategy Development 2 06-08-2007 02:00 PM


All times are GMT -6. The time now is 04:24 PM.