• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


My Indicator not appearing in indicator list on 'Condition and Actions' step

  • Filter
  • Time
  • Show
Clear All
new posts

    My Indicator not appearing in indicator list on 'Condition and Actions' step

    I have a handful of indicators that don't directly inherit/derive from [I]Indicator [/I]class. They derive from a custom class, which then derives from [I]Indicator[/I].

    For example:

    public class myClass1 : myClass2
    { ...}

    public class myClass2 : Indicator
    { ...}

    So, when going through the [I]Strategy Builder wizard[/I], on the "Conditions and Actions" step, when you add a new condition, my indicators don't appear in the list. I'm assuming it's because of the above situation.

    What can I do to help that?

    FYI, on every other "indicator list" within NinjaTrader (setting alerts on the Chart or Market Analyzer, for example), my indicators appear just fine. It seems it's just this one list where they don't appear (or doesn't have a subfolder that contains them).

    Any help is greatly appreciated!
    Last edited by neoikon; 02-19-2019, 11:28 AM.

    Hello neoikon,

    Thanks for your post.

    I should mention that creating custom classes and using inheritance to create your own indicator classes would be something that is outside the context of NinjaTrader support. I would suggest creating a non-inherited version of the script to see if you are encountering any issues. If you are still encountering issues after removing the custom class and inheritance, please let us know so we can look into the matter further. If you find that the inheritance is causing this issue, I would advise against using it when you would like to create Strategy Builder strategies with your indicators.

    I look forward to being of any further assistance.
    Last edited by NinjaTrader_Jim; 02-19-2019, 02:25 PM.
    JimNinjaTrader Customer Service


      Hello Jim,

      Thank you for the reply. My indicators do create multiple Plots, which I can successfully access in Market Analyzer as well as use to trigger alerts, etc), so I don't believe that is the issue.

      I will try to find a way around using inheritance to accomplish what I need. One of the reasons is due to shared code across multiple indicators. Is there a good solution to this?

      Why does the indicator list throughout the NinjaTrader platform work one way, but this one works differently?


        Hello neoikon,

        You could potentially use partial classes to share code between your indicators. These partial classes should be created in the AddOn folder to avoid having NinjaScript generated code conflict with your own partial classes. We have some detail in the help guide and I'll include a link below. This would be the equivalent of UserDefinedMethods in NinjaTrader 7.

        Code Breaking Changes Implementation Changes (See Partial Classes) - [URL="https://ninjatrader.com/support/helpGuides/nt8/en-us/index.html?code_breaking_changes.htm#ImplementationChangesOverview"]https://ninjatrader.com/support/help...hangesOverview[/URL]

        Different parts of NinjaTrader may be treated like separate independent components, and there may be some internal difference between how one component lists and another.

        While I mentioned that incorporating inheritance with the script puts the code outside of something we could support, if you do find that inheritance shows a difference in behavior, could you present a bare bones example that simply demonstrates inheritance alone will prevent the indicator from listing? We could forward the example onward to request consistency in this area if that is the case.

        Edit: I am responding for answers in a NinjaTrader 8 context since you are referring to the Strategy Builder. If you are referring to the Strategy Wizard in NinjaTrader 7, my recommendation would be to not use inheritance and to only use UserDefinedMethods as we will not be able to request new behavior for NT7.

        I look forward to being of any further assistance.
        Last edited by NinjaTrader_Jim; 02-19-2019, 02:17 PM.
        JimNinjaTrader Customer Service


          Indicators in the Strategy Builder will list if the indicator adds a plot. So if the indicator does not add a plot, it would not be listed.

          You sure about that?

          TickCounter has no plots, so why does it TickCounter show up in the list?

          See attached.

          Am I missing something? [ATTACH=JSON]{"data-align":"none","data-size":"large","data-tempid":"temp_52690_1550609682450_991"}[/ATTACH]


            Hello bltdavid,

            You are correct here. I had responded in reference to Alerts in NinjaTrader 8 which do require a plot to be listed in the Alerts window. My post is edited.

            [USER="6899"]neoikon[/USER] could you clarify if you are using the Strategy Wizard in NinjaTrader 7, or the Strategy Builder in NinjaTrader 8?
            JimNinjaTrader Customer Service


              Thank you again for the responses. Yes, I'm referencing NinjaTrader 8 and Strategy Builder.

              I looked into partial classes in the past and I wasn't able to get it to work for me. Perhaps I will take another look. I'm needing the shared code to actually run (OnStateChange(), OnBarUpdate(), OnRender(), etc) versus just static functions to perform common tasks.

              I will look into creating a bare-bones example and see if I can reproduce the issue, and get back.


                I've done some more digging and tried to re-create the issue using a bare-bones indicator (inheriting from a built-in indicator that has Plots, "Bollinger") and it all worked as expected. Then, I tried setting the base-bones indicator to inherit from my [I]custom[/I] indicator, which also worked as expected.

                So, I realized my original "not appearing within Strategy Builder" indicators aren't getting the automatic "NinjaScript generated code. Neither change nor remove." treatment. In other words, this code isn't automatically added to the bottom of my indicators for some reason, which causes it not to show up in the Strategy Builder, which makes sense.

                So, the next question is, what causes that automatic "NinjaScript generated code" to be triggered?

                EDIT: So, I'm also realizing that my bare-bones tester was originally inheriting from [I]Indicator[/I], which generated the wrapper code, then I changed it to inherit from Bollinger and then my custom indicator. So, that's why the code was there. So, that's fun.

                [I](I apologize for posting in the completely incorrect forum! I now see that this is a NT7 forum AND this seems to no longer be about strategy development. Please advise.)[/I]
                Last edited by neoikon; 02-20-2019, 09:36 AM.


                  Hello neoikon,

                  The NinjaScript file will be read when a compile is initiated from the NinjaScript Editor, and then NinjaTrader and adds the "NinjaScript generated code" region to the script when the class inherits from [I]Indicator. [/I]After the code is generated the compile is finished.

                  If you write this code yourself, it should be usable like a regular indicator. Building an indicator that inherits from another class that is not [I]Indicator [/I]will not generate this code and then would not have the same usability.

                  It's ok that the thread is not in the correct forum. I'll have this thread moved to the NinjaTrader 8 forum so it can be better found and referenced by others.
                  JimNinjaTrader Customer Service


                    I do most all my development in Visual Studio, so that could be a cause. After a couple years of the auto-generated code not being there (I didn't realize), I managed to get it generated via the built-in editor.

                    Unfortunately, when I click "compile" (within Strategy Builder) it simply gives an error saying, "Could not compile NinjaScript", then automatically opens the NinjaScript editor (which shows [I]no errors[/I] and compiles just fine).

                    If I click "unlock code", then try to build, there is an error "No overload for method '[I]myindy[/I]' takes 5 arguments". This explains the "could not compile" error above. However, this implies the generated code is incorrect somehow or [I]Strategy Builder[/I] isn't properly looking at the values. Do you happen to know what could cause this issue?

                    After a closer look, the auto-generated code shows 21 arguments, but the generated code for the Strategy Builder is only 5! When I manually give it the 21 arguments, it compiles.

                    Thank you for your time!
                    Last edited by neoikon; 03-01-2019, 09:54 PM.


                    Latest Posts


                    Topics Statistics Last Post
                    Started by tvaughan4, 12-13-2019, 10:46 PM
                    2 responses
                    Last Post tvaughan4  
                    Started by digibob, 12-13-2019, 10:01 PM
                    3 responses
                    Last Post digibob
                    by digibob
                    Started by ldissinger, Yesterday, 12:55 PM
                    1 response
                    Last Post ldissinger  
                    Started by pstrusi, Yesterday, 09:06 AM
                    1 response
                    Last Post marcus2300  
                    Started by vpzdcv, Yesterday, 02:31 AM
                    0 responses
                    Last Post vpzdcv
                    by vpzdcv