Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bug when exporting compiled assembly indicator

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

    Bug when exporting compiled assembly indicator

    Hello, I'd like to report a bug.
    I have a indicator that has 2 NinjaScriptProperty variables named WorkingVar and a BrokenVar
    BrokenVar is commented out using /* */ and it's initialization in SetDefaults is commented out using //
    the code normally compiles and will work when added to chart (altho this one doesn't do anything, my other indicators that had this bug happened did things and it worked correctly)

    but when I export this indicator as a compiled assembly and try to import it I get an error saying "Import failed. The NinjaScriptArchive File may contain duplicate method names that already exist on your PC, modify a method signature that other scripts were dependent on, or be missing a required file on either your PC or in the import archive."

    which was weird, but when I looked at the log of the Control Center or what's the main panel called, I saw these errors which thankfully pointed me in the right direction to find the problem.

    Error compiling import assembly: C:\Users\Seba\Documents\NinjaTrader 8\bin\Custom\CompiledAssemblyBugged.cs(49,115): error CS0117: 'CompiledAssemblyErrorBugged' does not contain a definition for 'BrokenVar'

    Error compiling import assembly: C:\Users\Seba\Documents\NinjaTrader 8\bin\Custom\CompiledAssemblyBugged.cs(47,114): error CS1061: 'CompiledAssemblyErrorBugged' does not contain a definition for 'BrokenVar' and no accessible extension method 'BrokenVar' accepting a first argument of type 'CompiledAssemblyErrorBugged' could be found (are you missing a using directive or an assembly reference?)

    I guess the compiler still detects the commented out variable for some reason.
    I can fix this by removing all the commented out variables out, but still this is an annoying bug.
    I am using NinjaTrader 8.1.2.0

    this is the test code, this indicator can't be imported once it's exported as a compiled assembly
    Code:
    namespace NinjaTrader.NinjaScript.Indicators
    {
        public class CompiledAssemblyBugged : Indicator
        {
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Enter the description for your new custom Indicator here.";
                    Name                                        = "CompiledAssemblyBugged";
                    Calculate                                    = Calculate.OnBarClose;
                    IsOverlay                                    = false;
                    DisplayInDataBox                            = true;
                    DrawOnPricePanel                            = true;
                    DrawHorizontalGridLines                        = true;
                    DrawVerticalGridLines                        = true;
                    PaintPriceMarkers                            = true;
                    ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                    //See Help Guide for additional information.
                    IsSuspendedWhileInactive                    = true;
    
                    WorkingVar = false;
                    //BrokenVar = false;
                }
                else if (State == State.Configure)
                {
                }
            }
    
            protected override void OnBarUpdate()
            {
                //Add your custom indicator logic here.
            }
    
            #region Properties
            [NinjaScriptProperty]
            [Display(Name = "This variable is working", Description = "", Order = 1, GroupName = "Parameters")]
            public bool WorkingVar
            { get; set; }
            /*
            [NinjaScriptProperty]
            [Display(Name = "This variable is broken", Description = "", Order = 1, GroupName = "Parameters")]
            public bool BrokenVar
            { get; set; }
            */
            #endregion
        }
    }​
    Let me know if I can help with anything else.
    Last edited by LuxSpuzy; 11-15-2023, 09:33 AM.

    #2
    Hello LuxSpuzy,

    Thank you for your post.

    The following is noted in the NinjaScript Best Practices at the bottom of the "Miscellaneous practices" section:
    • "Code in the Properties region of the NinjaScript object cannot be commented out with the /* */ style commenting, as it will cause issues with the wrapper generation. Code must be commented out with the // style."
    • https://ninjatrader.com/support/help..._practices.htm
    Please test by commenting out each line separately with // rather than using /* and */ comments, and this should resolve this item. This is a known limitation with wrappers and how they are generated.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      ah okay, didn't know it's a known limitation. thank you for your fast reply

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      4 views
      0 likes
      Last Post rbeckmann05  
      Started by rhyminkevin, Today, 04:58 PM
      4 responses
      52 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      8 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Working...
      X