I would like to create a DLL with few indicators and then protect it with
Agile.NET for NT (Protect NT6 Add Ons)
is it possible?
I would like to create my own DLL without using the NinjaTrader Export Tool and using Visual Studio Common Edition 2022 so I have control about the visibility of some classes as I used to do with Ninjatrader7. But with Ninjatrader 8 it appears to be much more difficult.
Here the questions (essentially 2 questions):
1.
- in the cs project I did put as reference
"c:\Program Files\NinjaTrader 8\bin\NinjaTrader.Core.dll"
"c:\Program Files\NinjaTrader 8\bin\Custom\Backup\NinjaTrader.Custom.dll"
Is it correct to reference NinjaTrader.Custom.dll from the backup dir? I'm puzzled.
2.
Also this simple test code doesn't compile (but I haven't referenced NinjaTrader.Custom.dll yet)
Here's the test code
using System;
using System.ComponentModel;
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 static NinjaTrader.CQG.ProtoBuf.Quote.Types;
using System.Xml.Linq;
namespace NinjaTrader.NinjaScript.Indicators
{
[Description("A simple SMA indicator built as a DLL")]
public class SimpleIndicator_DLL : Indicator
{
private SMA sma;
[NinjaScriptProperty]
[Display(Description = "SMA calculation period", GroupName = "Parameters", Name = "Period", Order = 1)]
[Range(1, int.MaxValue)]
public int Period { get; set; }
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "A simple SMA indicator built as a DLL";
Name = "SimpleIndicator_DLL";
Period = 14;
// Set default plotting properties
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
IsSuspendedWhileInactive = true;
}
else if (State == State.DataLoaded)
{
// Initialize SMA
sma = SMA(Period);
// Add plot
AddPlot(new Stroke(Brushes.DodgerBlue), "SMA");
}
}
protected override void OnBarUpdate()
{
// Calculate and plot SMA
Value[0] = sma[0];
}
}
}
Error (active) CS0246 The type or namespace name 'RangeAttribute' could not be found (are you missing a using directive or an assembly reference?) MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 24
Error (active) CS0509 'SimpleIndicator_DLL': cannot derive from sealed type 'Quote.Types.Indicator' MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 18
Error (active) CS0246 The type or namespace name 'SMA' could not be found (are you missing a using directive or an assembly reference?) MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 20
Error (active) CS0246 The type or namespace name 'DisplayAttribute' could not be found (are you missing a using directive or an assembly reference?) MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 23
Error (active) CS0246 The type or namespace name 'Display' could not be found (are you missing a using directive or an assembly reference?) MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 23
Error (active) CS0246 The type or namespace name 'Range' could not be found (are you missing a using directive or an assembly reference?) MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 24
Error (active) CS0115 'SimpleIndicator_DLL.OnStateChange()': no suitable method found to override MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 27
Error (active) CS0115 'SimpleIndicator_DLL.OnBarUpdate()': no suitable method found to override MyIndicatorsDLL d:\Work\NJ\Projects\NJ8\Amy8\MyIndicators\SimpleIn dicator_DLL.cs 53
Warning There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "NinjaTrader.Core", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. MyIndicatorsDLL
Warning There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "NinjaTrader.Gui", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. MyIndicatorsDLL

Comment