Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CS1001 Identifier Expected

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

    CS1001 Identifier Expected

    In line 170 I am getting a CS1001 error and the link is a 404 Page Not Found. I am sure it is simple, again, but I have tried all of the symbols and even edited (Position) to different things. I looked at the code break from 7 to 8 and it is not listed on there either. I know it is probably something so simple, but I cannot figure it out. Can anyone Help?

    Thanks!

    Connor.
    Attached Files

    #2
    Hello Connor,

    The OnPositionUpdate override is not properly defined.

    Below is a public link to the help guide on OnPositionUpdate().


    From the help guide:
    Code:
    protected override void OnPositionUpdate(Position position, double averagePrice, int quantity, MarketPosition marketPosition)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Connor,

      The OnPositionUpdate override is not properly defined.

      Below is a public link to the help guide on OnPositionUpdate().


      From the help guide:
      Code:
      protected override void OnPositionUpdate(Position position, double averagePrice, int quantity, MarketPosition marketPosition)
      I guess I just misinterpreted that section originally. Thank You!

      Comment


        #4
        NinjaTrader_ChelseaB Hello,

        Why does this throw error CS1001:
        NinjaScript File Error Code Line Column
        _MyListIndicator.cs Identifier expected CS1001 164 74
        Code:
        Print("3 " + "Average = " + MyList.Take( (MyList.Count-4)..(MyList.Count) ).Average() );
        The error underlnes this part ..(

        No error on this other test:
        Test your C# code online with .NET Fiddle code editor.

        Comment


          #5
          I tested with Roslyn 4.8 and it throws the error:
          Test your C# code online with .NET Fiddle code editor.


          What's the alternative for 4.8 to range notation?

          Ok, GetRange seems to work with .Net 4.8:

          Code:
          
                  //Console.WriteLine(duplList.Take( (duplList.Count-6)..(duplList.Count) ).Average()); // {1, 2, 3} -> 6
                  Console.WriteLine(duplList.GetRange( (duplList.Count-6),(6) ).Average());​
          Test your C# code online with .NET Fiddle code editor.



          ref.
          With C# 8 we got ranges to get "sub lists". While this works: var array = new string[] { "abc", "def", "ghi" }; var subArray = array[0..1]; // works This do...


          I would like to select a range of items in an array of items. For example I have an array of 1000 items, and i would like to "extract" items 100 to 200 and put them in another array. Can you help ...

          Last edited by PaulMohn; 09-20-2024, 12:25 PM.

          Comment


            #6
            Hello PaulMohn,

            This would be advanced custom C# and would be out of the realm of what our support assists with.

            You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services.

            You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more!
            Programming Services - https://ninjatraderecosystem.com/sea...mming-services
            Educators - https://ninjatraderecosystem.com/sea...ures=education

            You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third party services for NinjaTrader all pricing and support information will need to be obtained through the consultant.

            This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

            Please let me know if you have any questions, or if I can provide any further assistance.​
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              .Net 4.8 GetRange()
              and
              .Net 4.8 GetRange() .ForEach(s => Print(s));

              Comment


                #8
                Hello!
                You can use chatgpt too btw, its really good

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                599 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                344 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                558 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                557 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X