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 i2w8am9ii2, Today, 04:36 PM
                  1 response
                  2 views
                  0 likes
                  Last Post NinjaTrader_ShawnB  
                  Started by WeyldFalcon, Today, 02:07 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_ThomasC  
                  Started by hfwiley, Today, 03:02 PM
                  2 responses
                  16 views
                  0 likes
                  Last Post hfwiley
                  by hfwiley
                   
                  Started by pdennis, Today, 02:34 PM
                  3 responses
                  15 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by tonynt, Today, 01:47 PM
                  3 responses
                  17 views
                  0 likes
                  Last Post NinjaTrader_Kate  
                  Working...
                  X