Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Default parameter specifiers not permitted

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

    Default parameter specifiers not permitted

    Hi, I am adding my methods to UserDefinedMethods (in NS 7, 32 bit).

    My methods do not accept optional parameters as arguments, and throw the above error. My research says need to have .NET 4.0+ which I do. Please help.

    Reproduction (the bold does not work when '= false' is added'):

    public bool myFunction( int BarsBack, bool test = false )
    {
    //some code
    }

    EDIT: Looked at HELP tab, it says
    .NET/CLR Version: 2.0.50727.8669

    Is it running an old version of .NET? If so, can we make it use the latest?

    #2
    Hello,
    NinjaTrader 7 uses the .NET Framework 3.5 as does NinjaScript.
    Methods used in .NET 4.0 and above would not be able to be used in NinjaTrader 7. NinjaTrader 8 does support .NET Framework 4.0.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much, Cody. Downloaded NT 8, and managed to migrate from NT 7, a large historical database, without any issues. I will check the problem I reported here a bit later, but I am sure it will be ok now.

      Regards, steve

      Comment


        #4
        I figured out a way to do it in NT7 as a workaround. I can use parameter overloading in methods.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X