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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        46 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        141 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        275 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X