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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        77 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X