For some rigorous statistical calculations, I tried to use Meta.Numerics which is a 3rd party maths and statistical library for .Net platform. So I did the following:
1- Downloaded the reference dll
2- Copied it to C:\Users\***\Documents\NinjaTrader 7\bin\Custom
3- Added the address in References... dialog box
4- Restarted NT7 (32-bit)
5- added the libraries in "Using declarations" section
Up to this point, everything went smooth and the code compiled without a hitch. But when I wanted to use a type with "new" command, after compiling, the strategy didn't show up in the strategy list to add to my chart. Now I know that when this happens, it indicates that something is wrong in the compiling but it is beyond my comprehension. Also I read somewhere in the forum that to use 3rd dlls, they must be compiled using .Net version 3.5, but yet again I'm not that into programming to check if the version of the aforesaid dll.
Here's the simple code that I used:
#region Using declarations using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Indicator; using NinjaTrader.Gui.Chart; using NinjaTrader.Strategy; using Meta.Numerics; using Meta.Numerics.Statistics; using Meta.Numerics.Statistics.Distributions; #endregion // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { /// <summary> /// Enter the description of your strategy here /// </summary> [Description("Enter the description of your strategy here")] public class Foo : Strategy { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // User defined variables (add any user defined variables below) #endregion /// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> double outp; Distribution d = new LognormalDistribution(); protected override void Initialize() { Distribution d = new LognormalDistribution(); CalculateOnBarClose = true; outp = d.Median; Print("Output is: "+outp); } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { } #region Properties [Description("")] [GridCategory("Parameters")] public int MyInput0 { get { return myInput0; } set { myInput0 = Math.Max(1, value); } } #endregion } }
https://metanumerics.codeplex.com
Any help will be greatly appreciated. Thanks in advance.
Comment