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 Tim-c, Today, 02:10 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      2 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      50 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      10 responses
      399 views
      1 like
      Last Post beobast
      by beobast
       
      Started by lorem, Yesterday, 09:18 AM
      5 responses
      23 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X