Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ML.net in NinjaTrader 8

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

    ML.net in NinjaTrader 8

    Hello forum. I have been using ML.net with NinjaTrader for about a year now and wanted to think tank with others who have also been using it successfully. I recently started developing models using the Time Series (SSA) but find it disappointing that MS has not been able to move outside of the univariate realm. I only trade using range charts (200, 40) on the NQ but want to develop models using 12 hour segments (6pm - 6am and 6:00am to close). The new Event contracts coming out look like a good opportunity to develop some models to get ahead of the crowd.

    Look forward to hearing from you.

    Tom
    Intelligent Trader Inc.
    NinjaTrader Ecosystem Vendor - Artificial Intelligence Based Indicators

    #2
    Hello intelligenttrader,

    Thanks for your post.

    Using ML.NET in a custom NinjaScript would go beyond the level of support we can provide here in the Support department at NinjaTrader.

    You could find some information about this in the forum thread linked below.

    I have created a machine learning project in Visual Studio using ML.NET. The project uses the Microsoft.ML nuget package which has various other dependencies. I would like to get this into Ninjatrader for use in a trading strategy. Is it possible to add the required project to the Ninjatrader solution file and reference the


    That said, this thread will be open for other community members to share their insights on using ML.NET in a custom NinjaScript.

    Let me know if you have further questions.

    <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
      Hi Brandon,

      Thanks for chiming in. I wasn't actually looking for support on ML.net. I already use it successfully and just wanted to link up with other programmers / traders who also have figured out how to use it within NinjaTrader. It is actually quite easy to export training data from NinjaTrader to a txt or csv file for training in ML.net and then use that data to make predictions. The hard part is the data science end figuring out what algos to use.

      Thanks.

      Tom
      Intelligent Trader Inc.
      NinjaTrader Ecosystem Vendor - Artificial Intelligence Based Indicators

      Comment


        #4
        How is your foray into using ml.net with NT going? I'm just starting to code some strategies that build will build ml.net trading data.

        Obviously, strategies will have to be in .net 4.8. One question I do have, do you think it would be possible to use .net core for some of it? I suppose I could create a service that takes the data from the strategy and returns a buy or no-buy signal.

        Comment


          #5
          To intelligenttrader: I have been training models in ml.net's automl and it will go through many models to determine which will have the best metrics. That being said, certain ml algos tend to overfit more than others so a basic knowledge of what each one does is helpful. SVM vs Random Forest vs Light Gradient Boosting Machines vs Log Regression etc.

          I need help figuring out how to "consume" the trained models in an indicator in NT. First I customize indicators to render plots that act as "features" and one containing a "label" for the training data. I actually train models on trade data and do a binary classification where the label 1 is hit a profit target and 0 is where it doesn't . Once the indicators are on the chart I output to CSV to I have all the features and label data ready to be sent to the training model in ml.net automl.

          Where I'm stuck is how to access the trained model for consumption in Ninjascript Editor. I'd like to assign all the feature indicator plot variables (features) to the feature inputs in the model so the model indicator's ultimate output is a 1 and 0 with the probability of each outcome just like when you evaluate it in ml.net. How do I reference it??

          If anyone can help me to accomplish this I'm willing to share some of the indicators I've created to output features. This includes: PutCallRatio features, VIX term structure features, Treasury Yield features, market depth (NOT in SuperDOM), volume delta features, Volume Profile features that actually output to the databox and has plots you can use in a strategy (POC, VAH, VAL, and high/low volume nodes), VWAP features, plus a speed of tape for volume and tick charts.

          Comment


            #6
            Guys, let me run this by you. With this ML.net, why not create it as a standalone executable program, and link the outputs from it into ninjatrader, by creating a .dll. this within itself seems to be the simpler remedy. After adding the .dll and linking it into Ninjatrader, you would simply add a using "name of .dll" then proceed to call the outputs into your strategy. Whereas Ninjatrader can not offer support for your ML.nett project they will offer support as how to call a.dll into Ninjatrader. Another thing you would need is for the standalone to load and start running at the same time Ninjatrader starts. Then it will run on a separate thread from the Ninjatrader is running, robbing it of no resources.

            Comment


              #7
              Guys, I could be wrong in part of my statement above, where I mentioned loading and starting the executable. When the strategy starts the using should start it.

              Comment


                #8
                What I did was create a web service that returns the ML model's output. It gets a bit tedious as I had a lot of features, but it worked. I had some other problems that prevented me from using ML.NET however.

                Comment


                  #9
                  masilver Mind sharing what those problems were?

                  Comment


                    #10
                    The problems were with my implementation, not with Ninjatrader. It's not always very clear how to properly setup features with ml.net.

                    Comment


                      #11
                      I was able to make ML.net work with my strategy using Web API method. I don't like using WebAPI as it adds little more setup for my customers but I don't see any other option right now. I could not directly reference Project or dll generated by ml.net project into NT 8.

                      If anyone was able to make their strategy work with ML.net project directly referencing dll in NT, then please let me know how did you do it.

                      Comment


                        #12
                        I have a full working example of how to properly load all the dll's into NinjaTrader and create an ML based strategy without having to call outside of NinjaTrader. It is a little hard to type out all the steps and can get a tad bit confusing with making sure all the proper things line up but feel free to email me and I can help walk anyone through it [email protected]

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        571 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        330 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        101 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        548 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        549 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X