Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

State.Terminated problem

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

    State.Terminated problem

    I have a strategy export script that I used in NT7 and am now using in NT8. I use it to export a couple hundred symbols each day to CSV format.

    Before in NT7, the State.Terminated event happened at the end of processing each symbol, so for each symbol in turn, I would see the temp file created and then the rename to the correct name as the State.Terminated event happened.

    With NT8, it is not working the same. In NT8, I first see all the temp files created for all the symbols be exported, then when the script is done with all symbols, all the temp files are renamed to the correct file name as the State.Terminated events are processed.

    Why is the State.Terminated event now not being sent for each symbol until after all symbols have been processed by the strategy?

    Note: I tried using the State.Transition event, but this never happens in the strategy as real-time data never is exported.

    #2
    Hello bluueskyy,

    Thank you for your note.

    Where are you using this code? Is this in a strategy? Are you running a backtest in the Strategy Analyzer?

    State.Transition will run between the States Historical and Realtime. No realtime data would be processed before or during State.Transition.

    Comment


      #3
      I am running a backtest in the Strategy Analyzer with around 250 symbols.

      - Analyzer begins processing symbol list
      - 250 temp files created and visible in File Explorer (export_SYM.csv)
      - Analyzer completes processing all symbols
      - State.Terminated fires for all symbols
      - All temp file streams are closed and renamed to final export name (SYM_MINUTE_01.csv)

      I use temp files because my export has the option of including the begin/end dates of the data in the file name and those are not known until the script has gone through all the data.

      So, even though the analyzer is showing that it processed a symbol, it is not sending the terminated event for that symbol until all symbols are complete. Is this the intended behavior?

      Since State.Transition will not work in this case, it would be nice if there was a State.HistoricalComplete event for when there is no more historical data for a symbol....

      Comment


        #4
        Hello bluueskyy,

        Thank you for your response.

        State.Realtime will be called at the end of all historical data being processed even in the Strategy Analyzer. However, this would be the same case where all the instrument would load their historical data first and then State.Realtime would be called.

        This would be expected and something you would need to be aware of for your scripts.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by i019945nj, 12-14-2023, 06:41 AM
        7 responses
        81 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by timmbbo, 07-05-2023, 10:21 PM
        4 responses
        158 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by tkaboris, Today, 08:01 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Lumbeezl, 01-11-2022, 06:50 PM
        31 responses
        818 views
        1 like
        Last Post NinjaTrader_Adrian  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X