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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        129 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        74 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        116 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        111 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        89 views
        0 likes
        Last Post CarlTrading  
        Working...
        X