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 10-13-2008, 08:42 PM   #1
billitin
Senior Member
 
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
Default Return value is zero

Hi, I'm developing an indicator and as a base I took WilliamsR and renamed it into MyIndicator. All I did was replacing the content of OnBarUpdate() from

Value.Set(-100 * (MAX(High, Period)[0] - Close[0]) / (MAX(High, Period)[0] - MIN(Low, Period)[0] == 0 ? 1 : MAX(High, Period)[0] - MIN(Low, Period)[0]));

to

Value.Set( Close[0] )

Now when I plot the indicator on the graph it looks fine, but when I try to call it in NinjaScript from OnBarUpdate(), like Print(MyIndicator(10)[0]), it always gives me zero. If I use WilliamsR(10)[0] in the same context I get normal values. Why is this?
Last edited by billitin; 10-13-2008 at 09:34 PM.
billitin is offline  
Reply With Quote
Old 10-14-2008, 08:32 AM   #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

Hello,


Are you calling this from a seperate indicator, from within MyIndicator, or from within a strategy?

Please post your code so we can take a look.
NinjaTrader_Ben is offline  
Reply With Quote
Old 10-14-2008, 04:43 PM   #3
billitin
Senior Member
 
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Ben, Im' calling MyIndicator from within a strategy and the basic code looks like:

OnBarUpdate() {
// do something
Print( MyIndicator(10)[0] );
}
billitin is offline  
Reply With Quote
Old 10-14-2008, 05:15 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

billitin,

It would be helpful if you could just export both your MyIndicator and your strategy and attach them here. That way we can evaluate it on our end without ambiguity. Thanks.
NinjaTrader_Josh 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
Return code from Indicatore Owlman Indicator Development 2 10-13-2008 01:21 AM
Cannot add return of SMA() RandyT Indicator Development 1 09-25-2008 06:10 AM
How to return the Position Entry Price?? Ninja in Training Strategy Development 3 08-05-2008 10:06 AM
Standard Return Code for Functions arbifox Automated Trading 1 12-13-2007 08:21 PM
Return values for NTOrderStatus() ccooper Automated Trading 2 11-11-2006 11:47 AM


All times are GMT -6. The time now is 03:44 PM.