Announcement

Collapse
No announcement yet.

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.

    Comment


      #3
      Thanks,

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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      72 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      143 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      76 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      47 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      51 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X