Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Play a sound when backtest is completed

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

    Play a sound when backtest is completed

    Hi support,

    It can take a long time to run the backtest, so I am wondering if there is an existing setting that would play a sound when the backtest is completed. Or how can I detect that my backtest is completed programmatically so I can call playsound()?

    #2
    Hello op1031,

    Thanks for your post.

    IsInStrategyAnalyzer could be used when the State == State.Terminated in OnStateChange() and then you could call the PlaySound() method within that condition to play a sound.

    When the strategy is run in the Strategy Analyzer and the backtest is complete, the strategy will reach State.Terminated and the PlaySound() method will fire to play a sound.

    For example:
    Code:
    else if (State == State.Terminated)
    {
        if (IsInStrategyAnalyzer)
        {
            PlaySound(NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert1.wav");
        }
    }​
    See the help guide documentation below for more information.

    OnStateChange(): https://ninjatrader.com/support/help...tatechange.htm
    IsInStrategyAnalyzer: https://ninjatrader.com/support/help...egyanalyer.htm
    PlaySound: https://ninjatrader.com/support/help.../playsound.htm
    <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


      #3
      Great, it works as expected. Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      41 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      28 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      45 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      37 views
      0 likes
      Last Post CarlTrading  
      Working...
      X