Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on try to add parameter

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

    Error on try to add parameter

    I am trying to add a parameter to a user Ninja 8 indicator but get a "class, delagate, enum, interface struct expected" error. Not sure what it is telling me it doesn't like about it other than it is clearly not happy. I copied the statements from an exiting indicator that compiles normally.

    ----------------------
    region Properties

    [Range(1, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Smooth", GroupName = "NinjaScriptParameters", Order = 0)]
    public int Smooth
    { get; set; }

    #endregion
    ------------------

    Any idea what I am doing wrong? After 10 years of Ninja 7 still learning about Ninja 8 so most likely a rookie error by me.


    Screen shot from the editor.
    Click image for larger version  Name:	image.png Views:	0 Size:	151.0 KB ID:	1233099


    Last edited by ct; 01-29-2023, 08:28 AM.

    #2
    Hello ct,

    Move your property declaration inside of your indicator class. (Between the curly braces for the class)

    See the NinjaScript Editor 401 training video if you are not familiar with scope.

    Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.Download NOW at http://ninjatrader.com/GetStarted fo...
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chesea

      That did the trick. I get to wear the dunce cap now for a while. Double rookie error. I thought I tried that but i didn't. You are an absolute star.

      Many thanks.

      Cheers from the far side of the planet.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by asd32, Today, 11:45 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by tkaboris, Today, 11:09 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by marco231, 03-20-2024, 03:56 PM
      5 responses
      156 views
      0 likes
      Last Post bnoisette  
      Started by tonynt, Today, 08:05 AM
      2 responses
      19 views
      0 likes
      Last Post tonynt
      by tonynt
       
      Started by victor68133, Today, 07:50 AM
      4 responses
      28 views
      0 likes
      Last Post backtester831  
      Working...
      X