Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    Brandon H.NinjaTrader Customer Service

    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

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bortz, 11-06-2023, 08:04 AM
                    47 responses
                    1,607 views
                    0 likes
                    Last Post aligator  
                    Started by jaybedreamin, Today, 05:56 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post jaybedreamin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    6 responses
                    19 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by Jon17, Today, 04:33 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post Jon17
                    by Jon17
                     
                    Started by Javierw.ok, Today, 04:12 PM
                    0 responses
                    15 views
                    0 likes
                    Last Post Javierw.ok  
                    Working...
                    X