Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sorting a two dimesional array

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

    Sorting a two dimesional array

    I'm restoring my indicators from a backup after a computer wipeout.

    There are (2) arrays of doubles: sortedLevels[,] and _levels[,] .

    The following line of code doesn't compile anymore... it used to!

    Code:
    sortedLevels=_levels.OrderBy(x => x[1]);
    The Ninjascript editor Intellisense dropdown DOES include the OrderBy method. The indicator does have "using" references to Linq and Collections, Generic.,

    The error message is:

    Double[,] does not contain a definition for OrderBy and no extension method OrderBy accepting first argument type double [,] could be found. Are you missing a directive or an assembly reference?

    Can you please assist? Thank you.

    #2
    Hello Ricam,

    May we have a screenshot of the references window?

    I would expect System.Linq to be available with the System.dll.

    https://stackoverflow.com/questions/...derby/47930641
    https://www.tutorialsteacher.com/art...rray-in-csharp

    Try making a clean install environment, then create a new test script with only that code.
    https://ninjatrader.com/support/foru...683#post783683
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Seems to be fixed. Compiles OK now, but haven't yet checked that the sort is working.

      I pasted this static public class into the MyCustomMethods Add-On, in the Indicator namespace.

      But should it be necessary to do this?

      Comment


        #4
        Hello Ricam,

        This shouldn't be necessary, it sounds like something is missing from your setup

        Did you try a basic test using OrderBy in a clean environment?

        If the clean environment works, do you still see issue after performing a Repair operation with a NinjaTrader installer?

        Please also include a screenshot showing your references in the NinjaScript Editor.

        Update installers may be downloaded here - https://ninjatrader.com/PlatformDirect

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        150 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X