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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X