Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cancel/Stop/Break button not visible during backtesting

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

    Cancel/Stop/Break button not visible during backtesting

    Hello guys,

    during backtesting there is no button to Cancel/Stop/Break.

    I'm attaching example of strategy code that can help to reproduce on your side and screenshot of the issue.


    PHP Code:
    
    
    public class NTQuestionBacktestingCancelButtonNotVisible : Strategy
        {
            private List<string> entryNames;
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Name = "NTQuestionBacktestingCancelButtonNotVisible";
                    Calculate = Calculate.OnBarClose;
                }
                else if (State == State.Configure)
                {
                    entryNames = new List<string>();
                }
            }
    
            protected override void OnBarUpdate()
            {
                var name = "Long" + CurrentBar;
                EnterLong(name);
                entryNames.Add(name);
    
                for (int i = entryNames.Count-1; i >= 0; i--)
                {
                    if(BarsSinceEntryExecution(entryNames[i]) >= 10)
                    {
                        ExitLong(entryNames[i]);
                        entryNames.RemoveAt(i);
                    }
                }
            }
        } 
    


    Please take look, thanks!


    Attached Files
    Last edited by login_dejavu; 04-10-2020, 01:51 PM. Reason: Baktesting, Strategy Analyzer

    #2
    Hello login_dejavu,

    Thanks for your message.

    The Strategy Analyzer implements an Abort button for Optimizations, but does not implement it for standard backtests. As such we are tracking interest to implement the Abort button in the Strategy Analyzer for standard backtests with the enhancement ticket ID SFT-1359. I've added a vote on your behalf.

    For any other community members that would like to have this implemented, please let us know you would like us to add a vote for you too.

    We look forward to assisting.

    Comment


      #3
      Thanks! Otherwise I forced to do ugly hacks like this

      PHP Code:
      
      if(CurrentBar > 2 && Time[0].Date != Time[1].Date)
      {    
          if(System.Diagnostics.Process.GetProcessesByName("Notepad").Length != 0)
                throw new Exception("FORCED STOP");
      } 
      
      Last edited by login_dejavu; 04-11-2020, 06:14 AM.

      Comment


        #4
        I am sitting here in a backtest that I messed up in code and it is taking way too long. I need a way to abort the backtest and found this thread.

        Comment


          #5
          Hello bengalvfan,

          There is not Abort button with backtesting, just with optimizations. I have submitted a vote on your behalf to SFT-1359 so your interest is tracked as well.

          In the meantime, you could use the Windows Task Manager and expand the items under NinjaTrader (in the Processes tab) and you can select the Strategy Analyzer and End Task to close just that window.

          Comment


            #6
            Vote!
            I'have a backtest hanged that cannot abort.
            Thanks
            Francesco

            Comment


              #7
              Hello gneppe,

              Thanks for your post.

              Your vote has been added.

              Let us know if we may assist further.
              <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

              Comment


                #8
                Please add mine too. There's no way to cancel a forever looping backtest or for example one where you earlier had something like a bool haltprogram = true; if (haltprogram) return; type thing going on in OnBarUpdate for testing and forgot to comment it out, or if you accidentally put a years worth of range instead of a day, or if you forgot o check / update some parameter, etc. then the only way to cancel it is to shut the platform down and restart.

                There are soo many very good reasons to have a button labelled "Woah! Woah! Woah! Hang on! Hang on!". Although I bet your developers will insist on a more concise label but that's the functionality that's missing.

                I went looking for the solution and found this thread.

                Mark
                Last edited by markdshark; 06-02-2023, 03:51 PM.

                Comment


                  #9
                  Vote! from me too

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  85 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  47 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  29 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  32 views
                  0 likes
                  Last Post TheRealMorford  
                  Started by Mindset, 02-28-2026, 06:16 AM
                  0 responses
                  67 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Working...
                  X