Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Create a DLL Add-On indicator for NT8 with Visual Studio CE

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

    Create a DLL Add-On indicator for NT8 with Visual Studio CE

    Hi,
    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

    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];
            }
        }
    }
    here's the error messages

    Severity Code Description Project File Line Suppression State Details
    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






    Last edited by giogio1; 04-06-2025, 06:14 PM.

    #2
    Hello giogio1,

    Unfortunately I couldn't provide details on how to create indicators outside of NinjaTrader, that is currently not supported. If any users have had success in doing that they can certainly post their solutions here. Currently the only supported types for the external project are addons, that is the external visual studio solution found here: https://developer.ninjatrader.com/do...pment_overview

    The currently supported approach is to export the dll from NinjaTrader and use the built in agile.net to protect it.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X