Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Preventing NinjaScript generated code for partial class

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

    Preventing NinjaScript generated code for partial class

    I'm looking for a way to prevent the NinjaScript generated code from being generated for partial classes. I'm porting an indicator from NinjaTrader 7 and have the NinjaTrader.NinjaScript.Indicators class split up into multiple files.

    Take for example:

    File 1:
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class MyNinjaTraderIndicator : Indicators
    {
    // stuff
    }
    }
    -------------------------

    File 2 (same as file 1):
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class MyNinjaTraderIndicator : Indicators
    {
    // more stuff
    }
    }
    -------------------------


    The auto generated code is being generated for every single one of these partial classes, which does not compile as there are now multiple identical definitions (as auto generated by NT).

    Surely there is a way to prevent the NinjaScript generated code from being auto-generated? In NT7 this was possible by removing the class [Description], but this seem to have no effect in NT8.

    #2
    Hello deltaZ,

    Thanks for your inquiry.

    Can I confirm if you are still receiving errors from NinjaScript generated code when you do not inherit the Indicator base class in the second part of your partial class?

    For example for File 2:

    Code:
    namespace NinjaTrader.NinjaScript.Indicators
    {
    	// Do not leave base class in comments!
    	public partial class MyNinjaTraderIndicator
    	{
    		// more stuff
    	}
    }
    The NinjaScript Editor will scan the .cs file and see if the class inherits from a base class. (This includes commenting out the colon and the base class name) If it finds a colon and a base class name after the main class, it will add the NinjaScript generated code.

    If there is anything else I can do to help out, please let me know.
    JimNinjaTrader Customer Service

    Comment


      #3
      Great! Not inheriting from the base class did the trick. Thanks much.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by TradeSaber, Today, 07:18 AM
      0 responses
      4 views
      0 likes
      Last Post TradeSaber  
      Started by PaulMohn, Today, 05:00 AM
      0 responses
      9 views
      0 likes
      Last Post PaulMohn  
      Started by ZenCortexAuCost, Today, 04:24 AM
      0 responses
      6 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by ZenCortexAuCost, Today, 04:22 AM
      0 responses
      3 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by SantoshXX, Today, 03:09 AM
      0 responses
      17 views
      0 likes
      Last Post SantoshXX  
      Working...
      X