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-16-2008, 01:52 PM   #1
fifty2aces
Junior Member
 
Join Date: Oct 2007
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Default What's wrong with this?

Code:
if ((ATR(Period) >= Avalue) && (Range() <= Rvalue))
            {
                BarColor  = Color.Yellow;
            }
It produces two errors:
Operator '>=' cannot be applied to operands of type 'NinjaTrader.Indicator.ATR' and 'double'

and

Operator '<=' cannot be applied to operands of type 'NinjaTrader.Indicator.Range' and 'int'

Period and Rvalue are integers, Avalue is a double.


Thanks.
fifty2aces is offline  
Reply With Quote
Old 01-16-2008, 02:45 PM   #2
zoltran
Senior Member
 
Join Date: Nov 2005
Location: , Ontario, Canada
Posts: 400
Thanks: 0
Thanked 0 times in 0 posts
Default

You are trying to compare a the whole ATR array / data series... not just the last value.

Try ATR(Period)[0]

Same for Range, or any other indicator used like this.



Quote:
Originally Posted by fifty2aces View Post
Code:
if ((ATR(Period) >= Avalue) && (Range() <= Rvalue))
            {
                BarColor  = Color.Yellow;
            }
It produces two errors:
Operator '>=' cannot be applied to operands of type 'NinjaTrader.Indicator.ATR' and 'double'

and

Operator '<=' cannot be applied to operands of type 'NinjaTrader.Indicator.Range' and 'int'

Period and Rvalue are integers, Avalue is a double.


Thanks.
zoltran is offline  
Reply With Quote
Old 01-16-2008, 02:55 PM   #3
fifty2aces
Junior Member
 
Join Date: Oct 2007
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Default

Perfect, although now I'm feeling pretty stupid!

Thanks!
fifty2aces is offline  
Reply With Quote
Old 01-16-2008, 07:50 PM   #4
zoltran
Senior Member
 
Join Date: Nov 2005
Location: , Ontario, Canada
Posts: 400
Thanks: 0
Thanked 0 times in 0 posts
Default

No worries, we've all tripped over this one !
zoltran 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
can someone suggest what I'm doing wrong? coolmoss Indicator Development 7 12-06-2007 04:23 PM
Forex trading - wrong reporting, wrong Close action, connecting jcervinka Miscellaneous Support 2 08-30-2007 09:42 AM
[NT6 bug?] Compiles the wrong indicator FireFly General Programming 2 04-28-2007 06:45 PM
PnL wrong display PrTester Automated Trading 6 03-05-2007 10:24 AM
Wrong strategy executed BradB Automated Trading 1 02-21-2007 02:41 AM


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