• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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
    Paul H.NinjaTrader Customer Service

    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.
        Paul H.NinjaTrader Customer Service

        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:

              https://www.youtube.com/watch?v=YHap...PwADnn2hUDQoJL

              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.
                Paul H.NinjaTrader Customer Service

                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 NinjaCustomer, Today, 12:14 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Marco  
                  Started by U0000999, Yesterday, 11:49 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post U0000999  
                  Started by ahadari28, Yesterday, 04:01 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post ahadari28  
                  Started by TazoTodua, Yesterday, 06:00 AM
                  2 responses
                  19 views
                  0 likes
                  Last Post TazoTodua  
                  Started by TazoTodua, Yesterday, 09:06 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X