• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    Patrick H.NinjaTrader Customer Service

    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.
        Patrick H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rontronimous, Today, 09:41 PM
        0 responses
        1 view
        0 likes
        Last Post rontronimous  
        Started by 400396, Today, 09:34 PM
        0 responses
        2 views
        0 likes
        Last Post 400396
        by 400396
         
        Started by sandman55, Today, 08:00 PM
        0 responses
        3 views
        0 likes
        Last Post sandman55  
        Started by Oracletrades, Yesterday, 02:56 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Bbrandon5567, Today, 04:56 PM
        1 response
        8 views
        0 likes
        Last Post Bbrandon5567  
        Working...
        X