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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        566 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
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X