Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compile Error CS0103

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

    Compile Error CS0103

    Getting error CS0103 when I compile a new Strategy on the following code:

    [Description("Stop Offset from Fib Dot2")]
    [GridCategory("Parameters")]
    public int StopOffsetfromFibDot2
    {
    get { return stopOffsetfromFibDot2; }
    set { stopOffsetfromFibDot2 = Math.Max(1, value); }
    }

    Can you help?

    #2
    freeway,

    Looks like you need to make sure you have the following in your "variable" region.

    private int stopOffsetfromFibDot2;

    note the case.

    Ed

    Comment


      #3
      Thanks. That fixed the problem

      Comment


        #4
        Perhaps I spoke too soon. The compile worked after I first added the definition in the Variables region but I added some more code and now I get the same error. Here is the statement I added to the variables region:
        private int stopOffsetfromFibDot2 = 1; // Default setting for StopOffsetfromFibDot2

        The Error message says The name 'stopOffsefromFibDot2' does not exist in the current context.
        What else do I need to do?

        Comment


          #5
          freeway,

          If you could post more of your code it would be helpful or you can email it to support at ninjatrader dot com.
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Here is the code in the Variables Region:

            #region Variables
            // Wizard generated variables
            private string sessionBeginTime = "06:30:00"; // Default setting for SessionBeginTime
            private string sessionEndTime = "09:30:00"; // Default setting for SessionEndTime
            private int trade1Qty = 1; // Default setting for Trade1Qty
            private bool exitOnFibDot = true; // Default setting for ExitOnFibDot
            private bool exitOnBigMO = false; // Default setting for ExitOnBigMO
            private bool exitOnTLR1 = false; // Default setting for ExitOnTLR1
            private int stopOffsetfromFromFibDot = 1; // Default setting for StopOffsetfromFromFibDot
            private int stopOffsetfromBigMO = 1;
            // User defined variables (add any user defined variables below)
            private int stopOffsetfromFibDot2 = 1; // Default setting for StopOffsetfromFibDot2
            private int beginHH = 0;
            private int beginMM = 0;
            private int beginSS = 0;
            private int beginTime = 0;

            #endregion

            Here is the Properties Region code:

            Comment


              #7
              Didn't get that Properties region code in last replay. Here it is:
              #region Properties
              [Description("Session Begin Time")]
              [GridCategory("Parameters")]
              public string SessionBeginTime
              {
              get { return sessionBeginTime; }
              set { sessionBeginTime = value; }
              }

              [Description("Session End Time")]
              [GridCategory("Parameters")]
              public string SessionEndTime
              {
              get { return sessionEndTime; }
              set { sessionEndTime = value; }
              }

              [Description("Trade 1 Qty")]
              [GridCategory("Parameters")]
              public int Trade1Qty
              {
              get { return trade1Qty; }
              set { trade1Qty = Math.Max(1, value); }
              }

              [Description("Exit On Fib Dot")]
              [GridCategory("Parameters")]
              public bool ExitOnFibDot
              {
              get { return exitOnFibDot; }
              set { exitOnFibDot = value; }
              }

              [Description("Exit On Big MO")]
              [GridCategory("Parameters")]
              public bool ExitOnBigMO
              {
              get { return exitOnBigMO; }
              set { exitOnBigMO = value; }
              }

              [Description("Exit On TLR Cross of zero line")]
              [GridCategory("Parameters")]
              public bool ExitOnTLR1
              {
              get { return exitOnTLR1; }
              set { exitOnTLR1 = value; }
              }

              [Description("Stop Offset from FibDot")]
              [GridCategory("Parameters")]
              public int StopOffsetfromFromFibDot
              {
              get { return stopOffsetfromFromFibDot; }
              set { stopOffsetfromFromFibDot = Math.Max(1, value); }
              }

              [Description("Stop Offset from Big MO")]
              [GridCategory("Parameters")]
              public int StopOffsetfromBigMO
              {
              get { return stopOffsetfromBigMO; }
              set { stopOffsetfromBigMO = Math.Max(1, value); }
              }

              [Description("Stop Offset from Fib Dot2")]
              [GridCategory("Parameters")]
              public int StopOffsetfromFibDot2
              {
              get { return stopOffsetfromFibDot2; }
              set { stopOffsetfromFibDot2 = Math.Max(1, value); }
              }



              #endregion

              Comment


                #8
                freeway,

                I see nothing apparent that would cause this issue. When you added the variables, did you do so in the wizard or do so manually?
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  Seems to be resolved now. I added code manually. But is working now. Thanks

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  648 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  369 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  108 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  572 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  573 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X