Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicators, AddOns, Drawing Tools ... in Visual Studio Projects

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

    Indicators, AddOns, Drawing Tools ... in Visual Studio Projects

    This is a newb question(s) but I have been honestly going through the docs and forums looking for answers to my question. In a sentence, my question is, is there a better, more inclusive set of example projects I can build in Visual Studio to put addons, indicators, strategies into a dll and load them up in NT8?

    I have reviewed the NinjaTraderAddonProject.zip that's in the docs, and that's helpful. But, I seem to be unable to add an indicator to the dll, or build my own dll and have the indicator show up in the list of Indicators for a chart.

    It's unclear to me if I build an Indicator (that I want embedded in a dll, not as source code) derived from IndicatorBase, or if I need to include the "Ninjascript generated code" (I don't think so if going into a DLL). I'm a big learn-by-example guy. And, while there's a ton of strategies and indicators out there in source code, how to deliver them in an obfuscated dll is proving more challenging than I'd expect.

    Are there any more inclusive VS Projects out there that NT has made available, or that the community would share that would include several "types" of things (Indicators, Strategies, Drawing Tools, AddOns) all in one project (or a series of projects) that would make it easier for me to see a complete end-to-end example rather than just code snippets?

    We'll get to the code snippet questions when I can at least get the strategies and indicators to show up where I'd expect them in NT first.

    Thanks for everyone's patience and help here.

    #2
    Hello theTed,

    Thank you for the post.

    The addon project that you found in the help guide is really the best sample for that type of development that we have currently. That sample is also more intended for creating a custom addon and not for indicator/strategies or other types. That solution allows for xaml to be compiled so you can get around the issue of loading pages and parsing them and could do other more complex WPF tasks.

    For other types you may have issues in that use case depending on what it is such as an indicator with its generated code. Also anything that requires any type from the Custom dll would require that you add that as a reference, however that goes beyond what is documented so I am unsure if that works/has any issues. For indicators or other types in NinjaScript that are not addons the normal export process would be suggested.

    The NinjaScript generated code is used for allowing other types to access the indicator such as strategies. When an indicator is source code that will be added automatically but that wouldn't happen in your external project. If the indicator is going to be used in code you would have to generate your own code similar to what the platform makes but that again goes beyond what is documented so I am unsure if that could be done in that context.

    If any other users have successfully created an indicator in this environment potentially they can provide a solution for that use case.




    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by theTed View Post
      I seem to be unable to add an indicator to the dll, or build my own dll and have the indicator show up in the list of Indicators for a chart..
      NinjaTraders Help Guide:


      Under NinjaScript / Distribution


      and DLL Protection:




      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #4
        Thank you both for your help. I continue to look over the documentation which also includes those posted by =Edge=. Since it seems that there aren't any good "Building an Indicator in a DLL" documents, let's start simple.

        I've taken the NinjaTraderAddOnProject.zip, and I build it in VS. Builds fine. If I copy the resultant dll into the "Documents\Ninja Trader 8\bin\Custom" folder and start NT8, I get the warning from NT8 at startup about a third party dll ... I continue ... and after NT8 comes up if I go to "New" menu item I see the "AddOn Framework" menu item at the bottom of the list! Yay! That pretty much confirms that I can build the sample project and load it up in NT8. Success. Happy Dance.

        Next, if I add the following code to a new class in the project ...

        Code:
        namespace NinjaTrader.NinjaScript.Indicators
        {
            /// <summary>
            /// T3 Moving Average
            /// </summary>
            public class MY_T3 : IndicatorBase
            {
                protected override void OnStateChange()
                {
                    if (State == State.SetDefaults)
                    {
                        Description = "MY Indicator Description";
                        Name = "MY_Indicator_Name";
                    }
                }
        
                protected override void OnBarUpdate()
                {
                }
            }
        }
        (I excluded the Usings statements for brevity) the project builds fine. I go through the same steps of moving the dll to the bin\Custom folder. I WOULD EXPECT that I could start NT8, open a chart and then add an indicator called "MY_Indicator_Name" or perhaps "MY_T3" to the chart. But, I see no such indicators in the list of available indicators.

        My presumption is that NT8 would load the dll and via reflection see the MY_T3 class as derived from IndicatorBase and thus make it available as an Indicator for use. But, it appears my presumption is incorrect.

        What's the next step, what am I missing, in order to get my Indicator to show up in the list of available indicators for a chart? I know the dll is valid and is being loaded by NT8 because the "AddOn Framework" menu item is still available on the "New" top-level menu.

        Comment


          #5
          Hello theTed,

          I wouldn't be able to say here as there are no documented use case for that project with indicators. As edge pointed out the correct way to export an indicator as a dll is to use the platforms existing export tool.

          The visual studio project you are using is intended for compiled xaml addons as the only supported use case. If you want to use visual studio and also export the indicator as a DLL you would just use the NinjaScript editor and its visual studio button in the toolbar to edit the indicator from the NinjaTrader custom project.

          Please let me know if I may be of additional help.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Option Whisperer, 05-09-2024, 07:58 PM
          6 responses
          25 views
          0 likes
          Last Post Option Whisperer  
          Started by rayyyu12, Today, 05:38 PM
          0 responses
          12 views
          0 likes
          Last Post rayyyu12  
          Started by xepher101, Yesterday, 12:19 PM
          2 responses
          30 views
          0 likes
          Last Post xepher101  
          Started by thumper57, Today, 04:30 PM
          0 responses
          8 views
          0 likes
          Last Post thumper57  
          Started by OllieFeraher, 05-09-2024, 11:14 AM
          5 responses
          16 views
          0 likes
          Last Post MisterTee  
          Working...
          X