Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Writing data history to file does not include final bar

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

    Writing data history to file does not include final bar

    Hello,

    I created a strategy (based on other examples in the forum) that writes a range of history data to a text file. The problem I'm having is writing the final bar. For example, I will run the HIstorical Data download for a symbol for Jan 1 through today (running download in the evening, 4-5 hours after the U.S. market closes. I then run the strategy, and if I select DAY, then it will write all days up through yesterday, but not today's OHLC values. If I switch to minute, then it will write all Minute data, including today except for the final minute of the normal trading hour).

    What am I missing?

    Thanks,
    Ray
    Attached Files

    #2
    Hello jrm999,

    Thank you for the post.

    Since the strategy runs on bar close, you will not get todays timestamp until todays bar has closed. You can work around this by setting Calculate == OnEachTick and only running the logic for the first tick of the bar. See the attached modification of the script you posted.

    Please let me know if I can assist further.

    Attached Files

    Comment


      #3
      Thank you Chris. I made the change and it performed exactly as expected. I really appreciate your assistance.

      Ray

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      77 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X