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
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 } }
Comment