NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 12-22-2009, 01:38 PM   #1
paschall
Junior Member
 
Join Date: Dec 2008
Posts: 25
Thanks: 0
Thanked 0 times in 0 posts
Default how to tell if indicator has a value or is empty

Hi there. When I'm using an indicator that has two bins, such as AO with it's positive and negative, how do I reference the following idea:

when the AO(Positive) bin has a value, *do this*

when the AO(Negative) bin has a value, *do that*

I seem to remember coming across a NT script command to accomplish this for me, but I can't find it now. Any ideas?

thanks,
Dwayne
paschall is offline  
Reply With Quote
Old 12-22-2009, 01:58 PM   #2
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

You want to call the individual plots separately.

So for instance let us pretend the plot names are A and B.

Code:
if (AO(some parameters).A[0] > someValue)
     // Do something;

if (AO(some parameters).B[0] > someOtherValue)
     // Do something else;
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-22-2009, 02:03 PM   #3
paschall
Junior Member
 
Join Date: Dec 2008
Posts: 25
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Josh,
Thanks for the reply. Here is what I have now:

if (AO().AOPos[0] >= AO().AONeg[0])...do something.

But this isn't quit it. AOPos and AONeg can either:

1. have some value
2. be empty and not contain any value at all

I want to reference the condition where AO().AOPos[0] is not empty (condition #1). It can be any value. I simply want to know if it has a number in there.

Reason being, if I am in a short position, AO().AONeg will have values. At some point, when the Falling() condition reverses, AO().AOPos[0] will get a value, even though it may be a negative value at first.

How do I test for the condition "when AOPos gets a value"....?
paschall is offline  
Reply With Quote
Old 12-22-2009, 02:27 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

You have 3 plots. AOPos, AONeg, and AOValue. AOValue being a whole series with both pos and neg values. You can just compare AOPos against AOValue and AONeg against AOValue. Whichever one has the match is the one that has the value set.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-22-2009, 02:32 PM   #5
paschall
Junior Member
 
Join Date: Dec 2008
Posts: 25
Thanks: 0
Thanked 0 times in 0 posts
Default

Bingo! Thanks very much for the insight. Works perfectly.

Enjoy your holidays,
D
paschall 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
indicator folder empty when trying to import ctmach Installation and Licensing 3 11-15-2009 02:00 PM
referencing an empty value paschall Strategy Development 1 10-13-2009 04:35 AM
empty folders ckait Miscellaneous Support 15 04-27-2009 03:14 PM
High and Low empty for ADX indicator... wayneFH Indicator Development 1 05-05-2008 10:53 PM
Empty Indicator List yimbot Charting 6 10-17-2007 10:27 PM


All times are GMT -6. The time now is 05:34 AM.