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 chbruno, Today, 04:10 PM
      0 responses
      3 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      6 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by frslvr, 04-11-2024, 07:26 AM
      9 responses
      127 views
      1 like
      Last Post caryc123  
      Working...
      X