Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:

              The topic is "Programming Profitable NinjaTrader 8 Strategies", and bullet points include:- Using C# NinjaScript with NinjaTrader- Finding profitable trading...

              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 RookieTrader, Today, 07:41 AM
                  1 response
                  4 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by kujista, Today, 05:44 AM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by elderan, Yesterday, 08:03 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by samish18, Yesterday, 08:57 AM
                  8 responses
                  25 views
                  0 likes
                  Last Post samish18  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  3 responses
                  10 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Working...
                  X