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

It seems State.Configure is getting called way too many times

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

    It seems State.Configure is getting called way too many times

    Hello,

    As I am trying to debug strategy, and I am using multi time frame (with ticks coming very slowly for some particular instrument, at times could be 1 tick in few minutes time), it seems that State.Configure is called at least twice after hitting enabling strategy and hitting "OK" button.

    It also seems to be called when trying to disable strategy by opening dialog and unchecking "enable" strategy checkbox.

    Based on documentation, I though it would be called only once after hitting "OK" or "Apply" button, but it seems that the "State.Configure" gets called more than once.

    Also, State.Terminate seems to be called often as well.

    And as I am trying to initialize TriggerCustomEvent within State.Configure in order to call strategy later at specific time (to close position for example at certain time) - it becomes problematic because timer might get initialized twice and hitting at wrong interval etc...

    Do you have a sample to create my own timer (maybe sytem.threading) without using TriggerCustomEvent? TriggerCustomEvent seems to work fine when calling from Configure state but doesn't work if calling after strategy reached the State.Realtime...

    Thanks

    #2
    Hello,

    Thank you for the question.

    Yes, it would be expected that certain states are called multiple times such as adding the strategy to a chart would cause Configure to be called, also Enabling the strategy would cause this to be called. You can find the standard lifecycle of a NinjaScript object listed here: https://ninjatrader.com/support/help...fecycle_of.htm

    To better assist with this question, what specifically are you trying to do from State.Configure that requires using TriggerCustomEvent?

    Perhaps this is not the correct state for what you are trying if it requires that you use TriggerCustomEvent. In general, TriggerCustomEvent should only be used when the NinjaScript pointers would not be correct, like a buttons click event. This should not be used to otherwise use syntax in states where it may not be valid. Can you detail what you are trying to do so specifically or provide the syntax being used?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks,

      Used another timer on some other event and it works great.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by trilliantrader, Today, 03:01 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by geddyisodin, Today, 05:20 AM
      6 responses
      34 views
      0 likes
      Last Post geddyisodin  
      Started by pechtri, 06-22-2023, 02:31 AM
      9 responses
      122 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by frankthearm, 04-18-2024, 09:08 AM
      16 responses
      67 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by habeebft, Today, 01:18 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X