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

reload of indicator stage

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

    reload of indicator stage

    Hello i wanted to check and confirm the state changes when a user hits reload/F5 of an indicator?

    So that i can ensure any variable/internal settings i use are reset properly

    Also running in market replay would you expect it to be any different hitting F5 within replay and the state changes that ensue.

    1. this could be done in a pause state or
    2. this could be attempted whilst running replay

    would you expect differences in the above

    thanks

    #2
    Hello,

    Thanks for your post.

    The NinjaScript method OnStateChange() can be used to configure script properties, create one-time behavior when going from historical to real-time, as well as manage clean up resources on termination. This method will be the ideal way for you to deal with state changes in your script.

    The states will also not be any different when comparing real-time versus playback. It will see playback as a real-time state and the historical bars in replay as historical state just like you would expect when you are connected to a real-time data provider.

    I have included the help guide documentation for OnStateChange() below, for your convenience.

    https://ninjatrader.com/support/help...tatechange.htm

    If you have any further questions please let me know.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hello Josh, Im not sure if you are new to the team looking at the number of posts you have made.

      You have not addressed my question and i am aware of that link and checked it before making the post.

      If you are not sure on the question i would rather you forward this to someone more experienced. Hope this is ok but i specifically asked the sequence of states that are called when an indicator is reloaded/F5 after a chart is already opened and running data. Similarly for market replay
      thanks

      Comment


        #4
        Hello,

        The order of states after hitting F5 would be SetDefaults,Terminated, Configure, DataLoaded, Historical ,Transition, Realtime.

        You could use something similar to the snippet below to check your own individual script if you like. This will demonstrate what the current state is with a time stamp for reference. I have also attached the script that I used to test this.

        protected override void OnStateChange(){

        PrintTo = PrintTo.OutputTab1;
        Print(DateTime.Now + ": Current State is State."+State);

        }


        The help guide article below explains in greater detail how NinjaTrader changes states during the "life cycle" of your script.

        The NinjaScript Lifecycle
        https://ninjatrader.com/support/help...fecycle_of.htm

        If you have any further questions please let me know.
        Attached Files
        Last edited by NinjaTrader_JoshG; 10-04-2017, 09:24 AM.
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:10 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        13 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        5 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X