• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 erichuff, Today, 04:53 AM
        1 response
        24 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by stevenev1, Today, 01:43 PM
        0 responses
        8 views
        0 likes
        Last Post stevenev1  
        Started by shinuvu, Today, 11:05 AM
        3 responses
        18 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by Hagar, Yesterday, 07:12 PM
        2 responses
        22 views
        1 like
        Last Post Hagar
        by Hagar
         
        Started by PBreen, Today, 11:59 AM
        2 responses
        13 views
        0 likes
        Last Post PBreen
        by PBreen
         
        Working...
        X