Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

this.SetState();

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

    this.SetState();

    I am trying to debug a error - Code CS1501

    No overload for method " SetState" takes 0 arguments

    This is a NinjaScript File -
    Programming Profitable Trading Strategies in NinjaTrader 8 w/Scott Hodson

    #2
    Hello berringer,

    Thanks for your post.

    Here is a link to the helpguide section concerning the error code CS 1501: http://ninjatrader.com/support/helpG...us/?cs1501.htm

    The error message is advising that SetState() requires an input between the "()".
    Here is a link to the helpguide for SetState() method: http://ninjatrader.com/support/helpG.../?setstate.htm

    Here is a link to the helpguide that shows the various inputs for SetState(): http://ninjatrader.com/support/helpG...-us/?state.htm

    Comment


      #3
      SetState();

      if (IsFlat)
      {
      if (RegimeIsBullish && ReachedNewLowClose && ReachedLowRSILevel)
      {
      Buy();
      }
      }
      else
      {
      if (IsLong && ReachedNewHighClose && ReachedLongExitRSILevel)
      ExitLong();
      }

      Comment


        #4
        Hello berringer,

        Thanks for your post.

        I am unsure what you are asking. The code example is out of context as I do not know where it exists. Can you post (attach) the complete strategy? If you do not wish to post the strategy, you are welcome to send it into PlatformSupport[at]NinjaTrader[dot]Com. mark the e-mail subject Atten:Paul and include a link to this thread.

        Comment


          #5
          The complete strategy

          The complete strategy - CesarSalad

          I am unable to compile due to error as indicated previously
          Attached Files

          Comment


            #6
            Originally posted by berringer View Post
            SetState();

            if (IsFlat)
            {
            if (RegimeIsBullish && ReachedNewLowClose && ReachedLowRSILevel)
            {
            Buy();
            }
            }
            else
            {
            if (IsLong && ReachedNewHighClose && ReachedLongExitRSILevel)
            ExitLong();
            }
            What is the purpose of SetState() in the code? It seems to be pointless.

            Comment


              #7
              I didn't write this script - I follow instruction at a YouTube link on how to create the Strategy - it fails to compile- see here:

              Comment


                #8
                Hello berringer,

                Thanks for posting your code.

                In the OnBarUpdate() method you have this line: this.SetState();

                Later you have this line of code: void SetsState()

                I believe the intent of the first line is to call void SetsState.

                Note: Not to confuse things but to hopefully clarify, the method SetState() is a NinjaTrader defined method. If you change the 2nd line to void SetState() then the code will compile it however, I would recommend against using the name SetState because it is confusing due to the fact that NinjaTrader has a same named method.

                What I suggest is this:

                In the OnBarUpdate() method you have this line: this.SetMyState();

                Later you have this line of code: voidSetMyState()

                Basically you can name this as you wish as long as they are the same.

                Comment


                  #9
                  Now it works - voidSetMyState() did the trick, I need to pay more attention to spelling

                  Thank You

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Yesterday, 05:17 AM
                  0 responses
                  71 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  143 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  76 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  47 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  51 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X