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

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.
    JesseNinjaTrader Customer Service

    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 hdge4u, Yesterday, 12:23 PM
      1 response
      10 views
      0 likes
      Last Post hdge4u
      by hdge4u
       
      Started by 1001111, Today, 09:45 AM
      0 responses
      3 views
      0 likes
      Last Post 1001111
      by 1001111
       
      Started by DTSSTS, 01-28-2024, 12:07 PM
      11 responses
      557 views
      0 likes
      Last Post bmo111
      by bmo111
       
      Started by Torontobluejays, Today, 08:43 AM
      0 responses
      1 view
      0 likes
      Last Post Torontobluejays  
      Started by sastrades, 01-31-2024, 10:19 PM
      12 responses
      193 views
      0 likes
      Last Post sastrades  
      Working...
      X