Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

ContainsValue

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

    ContainsValue

    Hello,Support!

    Is there a way to have ContainsValue for the maximum bars,sort of like ContainsValue(infinite)?So it would keep the value for the infinite lookback period.So far i just have to store values via comma,like ContainsValue(0) || ContainsValue(1) || (2).......etc....Is there any workaroud?

    Thanks!

    #2
    Hello outsource,

    Thank you for your post.

    There is no option such as what you described. However, what are you attempting here? To verify that all points are valid in the entire data set? I would say a loop could do this but I assuming you plan to run this on every bar update in OnBarUpdate(), is this correct?

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello outsource,

      Thank you for your post.

      To verify that all points are valid in the entire data set? I would say a loop could do this but I assuming you plan to run this on every bar update in OnBarUpdate(), is this correct?
      Hi,Patrick,

      Yes and Yes.I want to keep signal for the entire data set and run it on OnBarUpdate.

      Comment


        #4
        Hello outsource,

        Thank you for your response.

        Looping through the entire data set on every bar update would not be advisable as it is likely to cause a performance issue. I would recommend just checking ContainsValue on the current bars ago value (0/zero). This would verify the value on each bar that updates.

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Hello outsource,

          Thank you for your response.

          Looping through the entire data set on every bar update would not be advisable as it is likely to cause a performance issue. I would recommend just checking ContainsValue on the current bars ago value (0/zero). This would verify the value on each bar that updates.
          Thanks,Patrick,can you please clarify value(0/zero)?Zero should be devided by zero?

          Comment


            #6
            I meant to clarify as zero, not divide by zero. So barsAgo value 0 (zero).

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              I meant to clarify as zero, not divide by zero. So barsAgo value 0 (zero).
              It doesnt update with every new bar like you said if i set value to zero.

              Comment


                #8
                Originally posted by outsource View Post
                It doesnt update with every new bar like you said if i set value to zero.
                Can you describe the behavior you are seeing? What is not working? What is occurring?

                Comment


                  #9
                  Originally posted by NinjaTrader_PatrickH View Post
                  Can you describe the behavior you are seeing? What is not working? What is occurring?
                  When i set ContainsValue(0),it just opens a position at a bar[0].It doesn`t update the signal with ech new bar.

                  Comment


                    #10
                    Originally posted by outsource View Post
                    When i set ContainsValue(0),it just opens a position at a bar[0].It doesn`t update the signal with ech new bar.
                    You should really post some sample code with your issue.

                    Maybe Koganam has an idea of what you are doing, but I can't make sense of it. Which probably means there is an easier way to do it than what you are trying to do.

                    Use the ContainsValue method on the Dictionary type. Test for value existence.

                    Comment


                      #11
                      Hello outsource,

                      Thank you for your response.

                      Would you be able to provide some sample code that demonstrates what you are trying to detail?

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by RookieTrader, Today, 09:37 AM
                      3 responses
                      14 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by kulwinder73, Today, 10:31 AM
                      0 responses
                      5 views
                      0 likes
                      Last Post kulwinder73  
                      Started by terofs, Yesterday, 04:18 PM
                      1 response
                      23 views
                      0 likes
                      Last Post terofs
                      by terofs
                       
                      Started by CommonWhale, Today, 09:55 AM
                      1 response
                      3 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by Gerik, Today, 09:40 AM
                      2 responses
                      7 views
                      0 likes
                      Last Post Gerik
                      by Gerik
                       
                      Working...
                      X