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

Getting Math function to work in NT8

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

    Getting Math function to work in NT8

    How do I reference the Math Class??

    VolumeX = Math.Statistics.InverseNormalDistribution(Volume[0], Mean, Std); ??

    Cant get to work.

    Thank you!

    #2
    Hello elcowen,

    Welcome to the support forums.

    Was the code you copied from something you had seen or used before? In C# the math library does not have a function named InverseNormalDistribution nor a Statistics namespace. This is also not something which comes default in NinjaScript.

    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      I followed the link in NinjaTrader Docs for Math.Class (https://ninjatrader.com/support/help...erence_wip.htm)

      Here's the linked site which does have the math I need.
      Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.


      How do I call these math functions in NT?

      Thanks Jesse!

      Comment


        #4
        Hello elcowen,

        The page you linked to is just the general help guide, you will need to right click on the link in the help guide and select copy link. Otherwise if the page has a link at the bottom that says permalink you can copy that.

        Are you asking how to use the code shown on MSDN in NinjaScript? If so that sample has methods and you could copy/paste them into your file if you wanted to use those specifically. The C# math functions can be used by using word Math or Math.Min() as an example.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Yes how do I use the MSDN code in NinjaScript? Do I have to import the module?? I just need access to statistics and other quantitative functions. If there's an easier way thats fine too.

          Thanks so much!

          Comment


            #6
            Hello elcowen,

            NinjaScript is just C# so you would use it just like you would in C# or in those examples. You need to make sure you have the System namespace in the using statements at the top of the file, aside from that nothing else would be needed. A default indicator should be able to use the Math class and its methods.

            Code:
            protected override void OnBarUpdate()
            {
                Print(Math.Min(12,10));
            }
            I am not aware of the statistics methods you are referring to but if that is something from a C# library you can likely use it.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Ok, so there's no way to utilize the math I referenced? Is there add-ons or anything where I can get access to quantitative methods? Thanks

              Comment


                #8
                Hello elcowen,

                Ok, so there's no way to utilize the math I referenced?
                Where did you copy that code from? Or was that just an example of what you want to make?



                Please let me know if I may be of additional assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  That Microsoft link has the math I need (the InvNormalDist) but how to I get access to that function in Ninjatrader? Thx!

                  Comment


                    #10
                    Hello elcowen,

                    That Microsoft link has the math I need (the InvNormalDist)
                    What link specifically? The links you provided did not link to anything specific and don't contain either of the items you are asking about. Please check the link you copy and make sure it goes to what you are trying to show.

                    If you can provide the direct link to what you originally asked about or what you are asking about in post 9 I could try to assist further.



                    Please let me know if I may be of additional assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      My bad. Sorry

                      I followed the link in NinjaTrader Docs for Math.Class (https://ninjatrader.com/support/help...erence_wip.htm)

                      Here's the linked site which does have the math I need.
                      https://docs.microsoft.com/en-us/dot...rk-4.8#methods


                      I just need access to any math functions (more than the basic ones NT provides). Doesnt matter where it comes from. I need to do statistical modeling somehow. Thanks!

                      Comment


                        #12
                        Hello elcowen,

                        You provided the same link again which just goes to the help guide in general, please check the links you copy before replying to the post.

                        If you want a link to something in the help guide you cannot use the address bar, right click on the link in the sidebar and copy its link or use the permalink at the bottom of the page.


                        The second link is to the Math in C#, what specifically on that page are you trying to use?


                        I just need access to any math functions (more than the basic ones NT provides).
                        Ok what math do you need and where does it come from? I would need a link to what you need help using so I can try to assist here. The links so far have not helped to explain the question further.


                        Doesnt matter where it comes from. I need to do statistical modeling somehow.
                        Again where does it come from? If you need something that is not available in NinjaScript or in C# you will have to likely create that or use a library/something external. If you have something in mind I may be able to help if you can provide a link directly to it.



                        Please let me know if I may be of additional assistance.
                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Perr0Grande, Today, 08:16 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post Perr0Grande  
                        Started by elderan, Today, 08:03 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post elderan
                        by elderan
                         
                        Started by algospoke, Today, 06:40 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post algospoke  
                        Started by maybeimnotrader, Today, 05:46 PM
                        0 responses
                        12 views
                        0 likes
                        Last Post maybeimnotrader  
                        Started by quantismo, Today, 05:13 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post quantismo  
                        Working...
                        X