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 i019945nj, 12-14-2023, 06:41 AM
                  3 responses
                  60 views
                  0 likes
                  Last Post i019945nj  
                  Started by TraderBCL, Today, 04:38 AM
                  2 responses
                  17 views
                  0 likes
                  Last Post TraderBCL  
                  Started by martin70, 03-24-2023, 04:58 AM
                  14 responses
                  106 views
                  0 likes
                  Last Post martin70  
                  Started by Radano, 06-10-2021, 01:40 AM
                  19 responses
                  610 views
                  0 likes
                  Last Post Radano
                  by Radano
                   
                  Started by thanajo, 05-04-2021, 02:11 AM
                  4 responses
                  471 views
                  0 likes
                  Last Post tradingnasdaqprueba  
                  Working...
                  X