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 kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        127 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        85 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        86 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X