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

shift left

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

    shift left

    Hello to the Forum,
    I would like to shift several true conditions in my historical data by one bar to the left.
    Example: The condition becomes true at bar 100, 200, 300 and should now also be true at bar 99, 199 and 299.
    How can I solve the problem.

    Thank you very much for your support and stay healthy!
    user10

    #2
    Hello user10,

    Thank you for your post.

    Could you clarify a bit about what you're trying to accomplish? How are you tracking your condition becoming true? What are you trying to retroactively do on the previous bar if the next is true?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello, Kate,
      I use several filters as boolean and want to synchronize them.
      The use of a series does not give me the possibility to move a condition one bar to the left, as it is possible with e.g. Close[1].
      Exactly such a method "Condition[int barsAgo]" I am looking for.

      Thanks for the support
      user10

      Comment


        #4
        Hello user10,

        Thank you for your reply.

        If you're using a series you can always reference the value of the series on the previous bar by referencing mySeries[1].

        I'd suggest using a bool series to track when your conditions become true. Here's an example from our help guide that shows how to set up a bool series:



        This way, when your conditions are true on a bar, you can set mySampleBoolSeries[1] to true so it's true for the previous bar to the one the conditions were actually true on.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello, Kate,
          Thank you for the advice.
          Unfortunately, I don't understand this approach; all my attempts shift to the right and not to the previous bar.

          if (cond) condSeries[0] = true;
          if (!cond) condSeries[0] = false;

          if (condSeries[0]) prevCondSeries[1] = true; // ??


          Don't I have to work with a list of events?
          Here I can determine the predecessor bar.
          I am missing the syntax for defining the previous bar as a boolean variable.

          With kind regards
          user10

          Comment


            #6
            Hello user10,

            Thank you for your reply.

            I'm afraid we may be confusing each other here. I'm a little confused as to what you're trying to acheive with your script. Would you be able to provide what you've currently got in your script? If you are uncomfortable sharing it on the forums, you can send it in directly to platformsupport [at] ninjatrader [dot] com. If you go that route, please put 2512715 ATTN Kate W in the subject line of your email.

            Thanks in advance; I look forward to assisting you further.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mmenigma, Today, 02:22 PM
            0 responses
            1 view
            0 likes
            Last Post mmenigma  
            Started by frankthearm, Today, 09:08 AM
            9 responses
            34 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by NRITV, Today, 01:15 PM
            2 responses
            9 views
            0 likes
            Last Post NRITV
            by NRITV
             
            Started by maybeimnotrader, Yesterday, 05:46 PM
            5 responses
            26 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by quantismo, Yesterday, 05:13 PM
            2 responses
            20 views
            0 likes
            Last Post quantismo  
            Working...
            X