Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What's wrong with this?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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.



    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.

    Comment


      #3
      Perfect, although now I'm feeling pretty stupid!

      Thanks!

      Comment


        #4
        No worries, we've all tripped over this one !

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frslvr, Today, 04:29 PM
        0 responses
        12 views
        0 likes
        Last Post frslvr
        by frslvr
         
        Started by wjadevries, Today, 04:18 PM
        0 responses
        5 views
        0 likes
        Last Post wjadevries  
        Started by shahabjet1, Today, 03:47 PM
        2 responses
        16 views
        0 likes
        Last Post shahabjet1  
        Started by JTizz, Today, 03:21 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by EB Worx, Today, 02:49 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X