Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaTrader generated indicator code should use namespace in the cache vars

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

    NinjaTrader generated indicator code should use namespace in the cache vars

    There are name clashes in the Indicator partial class if you redefine an indicator name within your own workspace. As a simple example, if I create an SMA indicator in a workspace (i.e. WS), I will get a a name clash because cacheSMA is already defined in the Indicator partial class.

    This would be solved if the generated code used the namespace (i.e. cacheWSSMA). Then I could have two SMA indicators that would not clash and could be called out via namespaces.

    Please consider fixing this.

    #2
    Hello aslane,

    In your example it is not the namespace which is the problem but the name of the generated cache variable, the namespace is being used in the generated code:
    Code:
    private CustomFolder.SMA[] cacheSMA;
    Adding the namespace wouldn't help here, a unique variable name would still be needed as this is a variable of the partial class. The SMA has the same named cacheSMA variable in its partial class causing an error.

    For your specific example there is also now logic in the newest update to prevent this situation. Using system indicator names like SMA specifically is not a valid name that you can use so this generates a warning now. This does not currently happen with custom indicator names so I will put in a feature request to have the wizards prevent you from creating an item that uses an existing name.

    If the goal is to have two SMA indicators which do not clash you would need to use two unique names such as SMA1 and SMA2 or you can use the existing SMA and a unique named type SMA1.


    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Right, but you made my point. The cache var should be "cacheCustomFolderSMA", then it would be unique.

      Anyway, does not matter, I suspected you would not support.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WHICKED, Today, 09:05 PM
      0 responses
      9 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by luislag14, Today, 06:29 PM
      0 responses
      8 views
      0 likes
      Last Post luislag14  
      Started by Protech, Today, 11:08 AM
      1 response
      23 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by guilhem, Today, 02:09 PM
      1 response
      24 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by Hyper, Today, 12:20 PM
      1 response
      23 views
      0 likes
      Last Post NinjaTrader_Jim  
      Working...
      X