Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy enters and exits positions 1 bar to late

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

    #16
    RJay,
    1. I think poseidon_sthlm question was the difference between indicator and strategy in back testing, so my answer was to his question, but its not me to say what he wants.
    2. I don't understand your statement
    Its the 800 pound gorilla in the software!!! They also deny it exists!!!
    and if NT deny it may be it doesn't exist.

    Baruch

    Comment


      #17
      Thankyou Baruch and rt6176 for your replies. I would apperciate a comment from somebody at the NT staff to confirm if what i wrote in post #13 make sense. I apologize if the word lag isn't appropriate.

      (I think that what I'm trying to describe is the same situation that occurs if you backtest a strategy.)

      Comment


        #18
        Poseidon, your post #13 mostly makes sense. There are a few words that could be changed for a better definition, but it is mostly on the money.

        I'll try to explain it again: While backtesting a strategy, the code inside OnBarUpdate() is run at the end of every bar (which is actually the beginning of the next bar - they're the same event). When this code runs, it looks for the conditions you specify. Lets say you have a simple strategy that goes long if the close of the bar is greater than the previous close. So the strategy would go looking for when Close[0] is greater than Close[1], and when it is, it submits an order to go long (at the end of the bar). It then takes a full OnBarUpdate() cycle to happen before the order gets filled at the open of the next bar (which is also the close of the previous bar). This is why it seems entries and exits "lag" the indicator by one bar, when in reality that is exactly what is expected.

        There are ways to reduce the lag, like adding intrabar granularity in another of my earlier posts.
        AustinNinjaTrader Customer Service

        Comment


          #19
          Austin,
          I don't think that you are correct. In live trading close of a bar is triggered by first tick of the next bar. So when you receive a tick of a new bar (and it can be much higher or lower in price of the close of the current bar) NT triggers OnBarUpdate() of a current bar, but executes the entry on the next bar because you all ready received a tick for it.

          An example:
          On a 5 min chart, you are on a 6:05 bar. The time now is 6:04:23 and you received a tick, which is added to the bar. Now the time is 6:05:11 and you didn't received a tick from 6:04:23. The bar of 6:05 is not closed yet. Only if now you receive a tick with a time stamp of greater than 6:05:00 the 6:05 bar will be closed and a new bar will be opened. So if at 6:07:22 you receive next tick, the 6:05 bar will be closed with a price of a 6:04:23 tick and 6:10 bar will be opened with a price of a 6:07:22 tick.

          Unless NT has some kind of a precaution the 6:05 bar can stay open even for 2 hours.

          Baruch

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          573 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          575 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X