Announcement

Collapse
No announcement yet.

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.

    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.

        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.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            116 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            61 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            40 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            44 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            82 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X