• 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

# of times State.SetDefaults is referenced with each OnStateChange?

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

    # of times State.SetDefaults is referenced with each OnStateChange?

    Hi there,

    This is a probably a softball question, but I'm going to ask it anyway.

    How many times are the SetDefaults and State.Configure areas called within the lifecycle of a NinjaScript strategy running through the day? My impression is that the default is to reference them every time there is a state change w/ OnStateChange().

    Is there any sort of performance hit with that, or is it negligible?
    Please let me know when you have a moment.

    Yours,
    Spiderbird
    Last edited by Spiderbird; 12-18-2017, 12:58 PM. Reason: (grammar)

    #2
    Nevermind!

    I just figured it out. I had to dig a bit into the existing help files for NT8 to get a proper reference. Pulled the trigger to soon on a forum thread.

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

    Comment


      #3
      Hello,
      Thanks for your post and I am happy to hear that you figured it out.

      For future reference, State.SetDefaults can be called multiple times since it will always be called when displaying objects in a UI list such as the Strategies dialogue window; this is because temporary objects are created for the purpose of UI display. State.Configure is called after a user adds an object to the applied list of objects and presses the OK or Apply button. This state is called only once for the life of the object.

      For anyone else that is interested, I have included some useful help guide links below that go over good practices for state management, performance considerations, and the NinjaScript Lifecycle.

      NinjaScript- Best Practices
      https://ninjatrader.com/support/help..._practices.htm

      OnStateChange()
      https://ninjatrader.com/support/help...tatechange.htm

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

      Please let me know if you have any further questions.
      Josh G.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bosajin, Today, 06:27 PM
      0 responses
      2 views
      0 likes
      Last Post bosajin
      by bosajin
       
      Started by saltminer, Today, 06:11 PM
      0 responses
      2 views
      0 likes
      Last Post saltminer  
      Started by epitoma, Today, 05:21 PM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by BatBart, Today, 01:24 PM
      1 response
      23 views
      0 likes
      Last Post NinjaTrader_Melissa  
      Started by ezrakoper, Today, 03:05 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X