Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to stop Indicator execution , without throwing exception?

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

    How to stop Indicator execution , without throwing exception?

    for exmaple, when specific event happens, I want to disable indicator working.

    At this moment, I use a bit inflexible approach,like:


    Code:
    ... OnBarUpdate()
    {
        if (LicenseNotActive) return;
    
    }

    however, I wish that I had a one-time executed function (like Application.Exit() , but this exits NT at all), so, i dont need to check any further OnBarUpdate or other events, indicator should just stop. Ideally, I wish something like this:


    Code:
    if (State==State.DataLoaded)
    {
       if (LicenseNotActive) IndicatorStop();  <--- something like this
    }
    what are available ways?

    #2
    Hello TazoTodua,

    Thank you for your post.

    You can likely use SetState for this use case: https://ninjatrader.com/support/help...htsub=setstate

    I am unsure what exception you are running into to provide any guidance on that. If you continue to see the exception while using this please let me know what exception you are seeing and we can continue reviewing the question.

    Please let me know if I may be of further assistance.

    Comment


      #3
      in "throwing exception" i meant to throw exception what will stop/exit indicator, like:

      if ( ! LicenseActive) then throw exception.. .

      so, indicator will exit.

      that is all i want, but , i dont want to throw that exception error message to user.



      thanks!! SetState(State.Terminate) does the job!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      72 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      152 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      100 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      288 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X