Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

basic Statistics functions

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

    basic Statistics functions

    I know that I can easily write the code for myself, but does C# have a library (or is there a NinJaTrader function somewhere) which calculates basic statistics of an array, such as Minimum, Maximum, Average etc... values?

    I don't want to become the 100,000,000,000,000th person to write a:

    public double Mean( double [] data) {...} function!!!!

    Thanks,
    Matthew.

    #2
    Hello mtthwbrnd,

    Thank you for your post.

    You can use the C# System.Math library in NinjaScript. That link takes you to the relevant MSDN article.

    C# Method (Functions) Reference from our help guide.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Those Min and Max appear to only handle two numbers. Is there a .NET or Ninjatrader function which will tell me the minumum value in an array? (or list etc...).

      Thanks,
      Matthew.

      Comment


        #4
        Hi Matthew,

        This is essentially what the NinjaScript functions MAX() and MIN() will do, but will only accept a dataseries as input.

        Minimum(MIN)

        Maximum(MAX)

        You can edit these functions to see the logic used. Tools > Edit NinjaScript > Indicator.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        161 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        310 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X