As I state in this post http://ninjatrader.com/support/forum...d.php?t=100183 , I recently changed my computer, installed Ninjatrader 8 and copied the code of my indicators and its dependency libraries to the new computer. The main (and I believe only) difference is the NT8 version.
Old computer: 8.0.2.0.
New computer: 8.0.6.1.
The problem is, after compiling ok (and even NinjaScript editor detecting the namespace of the library, aka suggesting autocompletions), I get the following error when trying to open the Indicators window in a chart:
"Error: Unable to create instance of NinjaScript 'NinjaTrader.NinjaScript.Indicators.zmqFeeder'. Most likely either the implementation no longer exists, there is no default constructor defined, the default constructor does not work correctly, or the 'OnStateChange' implementation for State=SetDefaults is flawed: Exception has been thrown by the target of an invocation.".
I have been googling for a bit but most of the posts regarding the same issue are related to the NinjaTrader 7 version. Others refer to a constructor without parameters not being present, but in my code, every class has a constructor with no parameters. Others mentioned they got it solved by restarting NinjaTrader, but no luck for me.
Could anybody help me? In the meantime, I will try to get the smallest case possible that reproduces my problem, and I will update this post when I have it.
I got a small case that reproduces the issue. The library I'm using is ZMQ,
more precisely, these bindings: https://github.com/zeromq/clrzmq4/releases
However, I'm using an older version. For using the exact same version, please download it from https://drive.google.com/open?id=0B9...jNtNURtYjNXS0k
Note the zip file is named Custom, because I made it directly from the "NinjaTrader 8/bin/Custom" folder, which is where I had the files. However, the top level ones were just for testing. The one I added in references in the NinjaScript editor was the one under "Custom/zmq/ZeroMQ.dll")
So, simply decompress the zip file and add the zmq/ZeroMQ.dll to the NinjaScript references.
This is the code of an indicator (named aaaTestIndicator).
#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; using ZeroMQ; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class aaaTestIndicator : Indicator { ZContext zmqContext; public aaaTestIndicator() { this.zmqContext = new ZContext(); } protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"A test indicator with the mere purpose of testing stuff."; Name = "aaaTestIndicator"; 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; } else if (State == State.Configure) { } } protected override void OnBarUpdate() { Print("A new bar was HERE"); } } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private aaaTestIndicator[] cacheaaaTestIndicator; public aaaTestIndicator aaaTestIndicator() { return aaaTestIndicator(Input); } public aaaTestIndicator aaaTestIndicator(ISeries<double> input) { if (cacheaaaTestIndicator != null) for (int idx = 0; idx < cacheaaaTestIndicator.Length; idx++) if (cacheaaaTestIndicator[idx] != null && cacheaaaTestIndicator[idx].EqualsInput(input)) return cacheaaaTestIndicator[idx]; return CacheIndicator<aaaTestIndicator>(new aaaTestIndicator(), input, ref cacheaaaTestIndicator); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.aaaTestIndicator aaaTestIndicator() { return indicator.aaaTestIndicator(Input); } public Indicators.aaaTestIndicator aaaTestIndicator(ISeries<double> input ) { return indicator.aaaTestIndicator(input); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.aaaTestIndicator aaaTestIndicator() { return indicator.aaaTestIndicator(Input); } public Indicators.aaaTestIndicator aaaTestIndicator(ISeries<double> input ) { return indicator.aaaTestIndicator(input); } } } #endregion
Comment