Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Extremely slow compilation after upgrade

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

    Extremely slow compilation after upgrade

    Hello,

    I have a few strategies that are pretty complex; e.g. about 20m lines of code. I was able to compile these files without any trouble in my previous version of NT. After upgrading recently, the show has come to a screeching halt. Compilation can take 20-30 minutes.

    I saw that other devs were experiencing similar problems here but supposedly the problem was resolved by upgrading to 8.1.3.0. However, I'm on 8.1.4.1 and the platform is almost unusable.

    Do I have any options aside from downgrading? If not, which is the best version for me?

    #2
    Hello hypercube,

    Thank you for your post.

    Thus far we have received no other reports regarding the last release, 8.1.4.1 from December 2023, and slow compilation times. If any other users are experiencing this, I would encourage them to chime in.

    That said, it is expected that the more scripts there are, the longer the compile takes. And typically if the compile completes once, subsequent compilation attempts complete faster.

    If you downgrade back to the previous version, does the issue resolve itself?

    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      I was incorrect. The problem was not related to upgrading NT.

      I learned that Ninjatrader recompiles all custom indicators/strategies each time you update anything. My stable of strategies became more complicated around the same time I moved up a version. That's when I began experiencing very long compile times and crashes.

      I need to find a way to separate all of my logic from the NT compilation process!

      Comment


        #4
        This note is just for anyone who might read this in the future.

        C# is a poor choice if your strategy goes beyond ordinary technical analysis/indicators. Data science ecosystem for C# is not great. If you're trying to combine NT for order execution and, say, Python for analysis, try creating a rest API that can be called from within your NT strategy.

        Roughly, you'll need a few includes:

        Code:
        using System.Text;
        using System.Net.Http;
        using System.Web.Script.Serialization;​
        Then, use your strategy to post data to a local API server, which you can create using Python/Flask. The API server can then consume data from NT, feed data to your Python models, and return a response back to your NT strat.

        Code:
        var formData = new List<KeyValuePair<string, string>>
        {
        new KeyValuePair<string, string>("Volume", Volume[0].ToString()),
        new KeyValuePair<string, string>("Close", Close[0].ToString()),
        //add additional datapoints elements here
        };
        
        var content = new FormUrlEncodedContent(formData);
        var qstring = $"http://localhost:5000/strategy_endpoint";
        
        var task = Task.Run(() => client.PostAsync(qstring, content));
        task.Wait();
        var response = task.Result;
        var txt = Task.Run(()=>response.Content.ReadAsStringAsync()).Result; //This API just returns a number. Extract it as text from the API
        model_output = Convert.ToDouble(txt); //Convert the API response to a num
        ​

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by WilsonFoster, Yesterday, 11:35 PM
        0 responses
        6 views
        0 likes
        Last Post WilsonFoster  
        Started by MiCe1999, Yesterday, 09:26 PM
        0 responses
        9 views
        0 likes
        Last Post MiCe1999  
        Started by connorlmarble, Yesterday, 08:25 PM
        0 responses
        10 views
        0 likes
        Last Post connorlmarble  
        Started by algospoke, 02-20-2025, 08:12 PM
        7 responses
        90 views
        0 likes
        Last Post MiCe1999  
        Started by MiCe1999, Yesterday, 05:55 PM
        0 responses
        11 views
        0 likes
        Last Post MiCe1999  
        Working...
        X