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 project addition

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

    #31
    I'm trying to write the ML code in a NT strategy. Ultimately, I may need to take the approach you are taking with VS and NT. I will see how far I can get the next couple of days.

    You need to reference each ModelInput property separately in the NT indicator unlike using the code snippet that ml.net creates.
    Can you provide an example of the statement above? I think I might be running into this issue as well.

    Thanks,
    eleven

    Comment


      #32
      Here's what the model builder automatically generates as a code snippet for use in an app (my project is called CLNS2). I'll use the Volume feature as an example. It has an 'F' after the value because it has to be a float value. NT doesn't recognize this, you have to convert your variables to floats:

      Code:
      //Load sample data
      var sampleData = new CLNS2.ModelInput()
      {
      Volume = 1751429F,
      };
      
      //Load model and predict output
      var result = CLNS2.Predict(sampleData);
      Each of those properties (Volume) can't be referenced by NT in this format. Create a float variable that you can convert the series variable to a float. You can still instantiate the sampleData variable BUT need to call the properties differently. The series variable will take in that property:

      Code:
      float v = (float)Volume[0];
      
      var sampleData = new CLNS2.ModelInput()
      
      sampleData.Volume = v;

      Comment


        #33
        Thanks for sending the example code. I did not get a chance to work on this last night, but I have some free time over the weekend.

        Comment


          #34
          I want to give a special shoutout to Lance El Camino. This guy went above and beyond to help me set this up. He didn't have to help, but he did. Thank you sir for your willingness to share your experience.

          Comment


            #35
            Hi guys,
            I'm a bit familiar with Machine Learning however, how to implement this concept into trading futures is hard, particularly engineering the trading data for use with ML. Can someone please provide guidance on how to achieve this?

            Comment


              #36
              I'm trying to reference and load native assembly "CpuMathNative.dll" but I get an error that it is not in a .NET format. Is it possible to load this dll in NT8?

              Comment


                #37
                Originally posted by eleven View Post
                I'm trying to reference and load native assembly "CpuMathNative.dll" but I get an error that it is not in a .NET format. Is it possible to load this dll in NT8?
                I believe you have to change your project to a Net4.8 before building the project.

                Comment


                  #38
                  Originally posted by Nyman View Post
                  Hi guys,
                  I'm a bit familiar with Machine Learning however, how to implement this concept into trading futures is hard, particularly engineering the trading data for use with ML. Can someone please provide guidance on how to achieve this?
                  Create an indicator with all your indicators and values you want to use in your ML project as "Features" and write them to a CSV file, create your model, then use the same "Features" as inputs in your strategy to predict via the model. It sounds simple, but there is a huge learning curve. However, if you have past knowledge, it should be easier to pick up the terminology and implement the model. It was a huge curve for me, but doable. It took me two weeks of non-stop reading and fiddling to figure it out.

                  Comment


                    #39
                    Originally posted by click4payday View Post

                    Create an indicator with all your indicators and values you want to use in your ML project as "Features" and write them to a CSV file, create your model, then use the same "Features" as inputs in your strategy to predict via the model. It sounds simple, but there is a huge learning curve. However, if you have past knowledge, it should be easier to pick up the terminology and implement the model. It was a huge curve for me, but doable. It took me two weeks of non-stop reading and fiddling to figure it out.
                    click4payday, thank you so much for your response and guidance. I struggled with creating the target especially when there are many features. But now I got it.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DanielTynera, Today, 01:14 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post DanielTynera  
                    Started by yertle, 04-18-2024, 08:38 AM
                    9 responses
                    40 views
                    0 likes
                    Last Post yertle
                    by yertle
                     
                    Started by techgetgame, Yesterday, 11:42 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post techgetgame  
                    Started by sephichapdson, Yesterday, 11:36 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post sephichapdson  
                    Started by bortz, 11-06-2023, 08:04 AM
                    47 responses
                    1,615 views
                    0 likes
                    Last Post aligator  
                    Working...
                    X