Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Type Error

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

    Type Error

    Dear Support,

    I get the following error "TSMOOTH is a type but is used like a variable." TSMOOTH is an enum Type containing several moving avarages and when called in the following code case this error is generated. The parameters in the code are those listed by Ninja SmartScript

    Code:
    case DivergenceMode.EsakIndicator:
    esakIndicator = EsakIndicator(20, 0.1, TSMOOTH, Brushes.Red, Brushes.LimeGreen);
    break;
    I tried Type.TSMOOTH and did not work. How should I list TSMOOTH as a Type in the above code.

    Many Thanks.​

    #2
    Hello aligator,

    Thank you for your inquiry.

    Could you provide the full code or the code where TSMOOTH is defined?

    esakIndicator = EsakIndicator(20, 0.1, TSMOOTH, Brushes.Red, Brushes.LimeGreen);

    What is supposed to be the type for this parameter you are trying to pass into the esakIndicator?

    I look forward to your response.

    Comment


      #3
      Originally posted by NinjaTrader_Gaby View Post
      Hello aligator,

      Thank you for your inquiry.

      Could you provide the full code or the code where TSMOOTH is defined?

      esakIndicator = EsakIndicator(20, 0.1, TSMOOTH, Brushes.Red, Brushes.LimeGreen);

      What is supposed to be the type for this parameter you are trying to pass into the esakIndicator?

      I look forward to your response.
      Thank you Gaby,

      TSMOOTH is a public eunm type containing several indicators, I can not send all these indicators. Relevant parts of indicator are shown as follow;

      Code:
      public enum TSMOOTH
      {
                                  Ema,
                                  Sma,
                                  Gauss,
                                  Butter,
                                  Smooth,
                                  Hp,
                                  Php2,
                                  Bp,
                                  Bs
       };
      ///////////////////////////////////////////////////////////////////////
                      Length                 = 20;
                      Delta                    = 0.1;
                      Type                    = TSMOOTH;
                      ColorD                 = Brushes.Red;
                      ColorU                 = Brushes.Lim
      ///////////////////////////////////////////////////////////////////////​​
              [NinjaScriptProperty]
              [Display(Name="Indicator Type", Order=2, GroupName="Parameters")]
              public TSMOOTH Type
              { get; set; }    ​
      All I need need to know is how to list TSMOOTH in post #1 code as a Type as listed by Ninja SmartScript.

      Thanks

      Comment


        #4
        Hello aligator,

        Thank you for your response.

        Code:
        [NinjaScriptProperty]
        [Display(Name="Indicator Type", Order=2, GroupName="Parameters")]
        public TSMOOTH Type
        { get; set; }


        'Type' is a reserved keyword. To avoid the error, you should name your variable something other than Type, such as TSmoothType or something else.

        That variable should be what is supplied to your indicator call, if that is the proper enum.​

        Please let us know if you have any further questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X