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

Simulated Data Feed - CalculateOnBarClose

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

    Simulated Data Feed - CalculateOnBarClose

    Hi:

    When running the simulated data feed with CalculateOnBarClose = false, my OnBarUpdate callback is only being called for historical data.

    I understand that I'll only get single events for historical data, but I don't get tick by tick events for current bar.

    I this a known issue with the simulator? I must be missing something.

    Thx

    #2
    Errr... It seems to be working now...

    There an issue in here somewhere... If I can pin it down to an NT bug, I'll let you know...

    So, nevermind...

    Thanks,

    Comment


      #3
      Ok,

      BarsRequired apparently defaults to some value like 10 or 20...

      OnBarUpdate won't be called until that many bars has been 'simulated'.

      Setting it to 0... didn't seem to work... locked NT up hard when adding the indicator to a chart.

      I guess the best I can do is set it to 1? How do I get OnBarUpdate called for the 1st bar?

      Comment


        #4
        Correct, BarsRequired defaults to 20. All it would have to satisfied for all series you potentially call in your script.

        This can be programmatically as well in the script's Initialize() :

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by BigWaveDave View Post
          Ok,

          BarsRequired apparently defaults to some value like 10 or 20...

          OnBarUpdate won't be called until that many bars has been 'simulated'.

          Setting it to 0... didn't seem to work... locked NT up hard when adding the indicator to a chart.

          I guess the best I can do is set it to 1? How do I get OnBarUpdate called for the 1st bar?
          It is possible to set BarsRequired to 0. BarsRequired suppresses the plot during the initial phase, but has no further impact on the execution of OnBarUpdate() unless you use it in the code. A typical example would be

          Code:
          if(CurrentBar < BarsRequired)
              return;
          In that case OnBarUpdate() will only be executed after BarsRequired is exceeded.

          If NT locks up hard, you will need to examine your code, you should find the reason there.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cre8able, 02-11-2023, 05:43 PM
          3 responses
          236 views
          0 likes
          Last Post rhubear
          by rhubear
           
          Started by frslvr, 04-11-2024, 07:26 AM
          8 responses
          113 views
          1 like
          Last Post NinjaTrader_BrandonH  
          Started by stafe, 04-15-2024, 08:34 PM
          10 responses
          47 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by rocketman7, Today, 09:41 AM
          3 responses
          11 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by traderqz, Today, 09:44 AM
          2 responses
          10 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X