Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automating Compilation and Backtesting of NinjaScript Code

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

    Automating Compilation and Backtesting of NinjaScript Code

    Hello NinjaTrader Community,

    I hope this post finds you well. I'm working on a project where I'm generating NinjaScript code dynamically and I need to automate the subsequent steps of compiling and backtesting this code. I have two related questions:
    1. Automated Compilation: I've noticed that when NinjaTrader is open, any changes I make to a .cs file in Visual Studio are automatically compiled. Is there a way to trigger this compilation process programmatically, for example, using a script or command line interface?
    2. Automated Backtesting: After compiling the new NinjaScript code, I need to run a backtest. Is it possible to execute a command in Visual Studio (or elsewhere) that triggers a backtest in NinjaTrader?

    Any guidance, insights, or references would be highly appreciated.

    Thank you in advance for your help. I look forward to hearing your thoughts and suggestions.

    Best regards, Aviram Y.
    Aviram Y
    NinjaTrader Ecosystem Vendor - Aviram Y

    #2
    Hello Aviram,

    Thanks for your post.

    No, there are no supported or documented NinjaScript methods or functions to programmatically compile a NinjaScript.

    There are also no supported or documented NinjaScript methods or function to programmatically run a backtest on a NinjaScript in the Strategy Analyzer.

    This forum thread will be open for other community members to share their insights on possible unsupported code that could accomplish this.
    <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
      Thanks for the quick reply! much appreciated.
      Aviram Y
      NinjaTrader Ecosystem Vendor - Aviram Y

      Comment


        #4
        Please please please support a CLI where we can run automated backtests to ensure we don't break things during iteration.

        I would like to be able to do something like the following:

        Code:
        NinjaTrader.exe /backtest <StrategyName> /template "C:\Users\<user>\Documents\NinjaTrader 8\templates\Strategy\<StrategyName>\<TemplateName>.xml" /instrument ES JUN24 /fromdate 03/07/2024 /todate 03/08/2024 /starttime 06:36 /endtime 7:09 /output "C:\Backtests\<StrategyName><TemplateName>.txt" /displaylogs /exporttrades /headless
        Should I create a new post specifically for automated headless backtests via a CLI or can this post cover the request?

        Comment


          #5
          Hello AdaptOD,

          Thanks for your notes.

          We are tracking interest for this in an existing feature request and I have added your vote to that feature request.

          This request is being tracked under the number SFT-631.

          As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted on the Release Notes page of the Help Guide.

          Release Notes — https://ninjatrader.com/support/help...ease_notes.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

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          656 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          371 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          579 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X