Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bools and [] indexing

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

    Bools and [] indexing

    I'm getting an "[] indexing" error when trying to use a bool in a condition where it is false a bar ago and true on the current bar. Could you please tell me the proper syntax. Thanks

    if (Bool1 = true[0] && Bool1 = false[1])
    do something;
    Last edited by kenb2004; 02-28-2011, 11:36 AM.

    #2
    Originally posted by kenb2004 View Post
    I'm getting an "[] indexing" error when trying to use a bool in a condition where it is false a bar ago and true on the current bar. Could you please tell me the proper syntax. Thanks

    if (Bool1 = true[0] && Bool1 = false[1])
    do something;
    Is the bool a BoolSeries ?

    Comment


      #3
      Thanks koganam - to set and work with historical values for bools you would need a BoolSeries Ken - http://www.ninjatrader.com/support/h...ries_class.htm

      Comment


        #4
        No the bool is not a BoolSeries it is a private bool

        Comment


          #5
          Then you would need to work with a boolSeries here instead, the regular bool variables do not hold historical values, just for example like a double - a series is needed then.

          Comment


            #6
            OK thanks I'll give that a try

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            67 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            36 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            60 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X