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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        28 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        284 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        281 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        132 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X