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

Using 3rd Party Indicators with Strategy Builder or NinjaScript

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

    Using 3rd Party Indicators with Strategy Builder or NinjaScript

    Hello,
    I purchased a suite of indicators from a 3rd party indicator provider that I wanted to test in Strategy Builder or using NinjaScript. The indicators were installed using an .exe file. I have the compiled assembly file (.dll) and template files (.xml) with the indicators already plotted in the NinjaTrader template folder. I am getting error CS0246 when attempting to compile. I unlocked the code and added the (.dll) file to "References" but then I got the error code CS0118.

    Is it possible to use Strategy Builder or NinjaScript to test indicators without the (.cs) file?

    I can create alerts and triggers using the same indicators after applying the indicator directly for the chart, but I wanted to dig deeper and add more conditions, but the alert interface is limited in that regard.

    Also, is possible to add conditions to alerts that only trigger if currently in an active position and if not in an active position?

    Thank you​
    Attached Files

    #2
    Hello trader07,

    Thanks for your post.

    I understand that the third-party AddOns came as an assembly (dll). Once an assembly is successfully imported, you will see that there is a .dll and a .cs file located in the Documents\NinjaTrader 8\bin\Custom folder.

    Note that NinjaScript AddOns are typically imported by going to Tools > Import > NinjaScript Addon. They are not usually imported using a .exe file.

    The error message codes CS0246 and CS0118 are typically caused when NinjaTrader is searching for a reference to a .dll file, and the reference does not exist.

    The error code CS0118 could also be caused when the indicator is being referenced/used incorrectly in the script.

    You could try reaching out to the developer of the indicator to get instructions from them on how to properly access/use the indicator in a custom NinjaScript strategy.

    As for your question about creating alerts in the Alerts window, it would not be possible to create a condition to check if you are in a position.

    See this help guide page for more information about configuring Alerts: https://ninjatrader.com/support/help...ing_alerts.htm

    ​This could be accomplished in a Strategy Builder strategy though by creating a market position comparison.

    Please see this help guide page demonstrating how to make market position comparisons: https://ninjatrader.com/support/help...ionComparisons

    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello Brandon,
      Thank you for replying to my post and answering my questions. There are no .cs files for the indicator. I am thinking it is designed this way to protect the intellectual property. I am not interested in getting the code as much as being able to test strategies with Strategy Builder or in NinjaScript but it appears the only way to accomplish this is with the .cs file. As you said, I am guessing that is the reason for me getting the error codes. I will have to continue to use alerts for certain crosses and breaks of certain points.

      I am aware of using the market position comparison in Strategy Builder but if I can’t use it in tandem with the 3rd party indicators, it won't trigger the way I need. So far, I am only able to create conditions for the 3rd party indicators in alerts, so I am trying to make using them with alerts like using them in Strategy Builder. It is not ideal but does somewhat of what I need.

      As far as the alerts go, is it not possible to create an indicator to return a value based upon my current market position? So, for example -1 on every bar for every bar it is short, 0 for every bar it is flat, and 1 for every bar that is long. The goal is to create alerts with basic numeric values. I want certain alerts to trigger only if flat, long, or short. I tried to find one already created but I haven't been able to. The best I could find was someone trying to accomplish the same thing on the forum. See the link below.


      Thanks again for your help.​
      Hello, I'm trying to create a simple indicator that will return a value depending on if I am flat or not. I found an old post doing something similar on NT7 and am trying to achieve the same in NT8. https://ninjatrader.com/support/forum/forum/ninjatrader-7/indicator-development-aa/46605-indicator-to-return-1-or-0-in-the-market

      Comment


        #4
        Hello trader07,

        Thank you for your reply.

        In order to use an indicator in the Strategy Builder, it must have public plots. Whether a an indicator has plots and whether those plots are public or not is up to the developer. Since it sounds like the indicator was provided to you as a protected assembly, you would have to reach out to the developer for more information about the script and whether there are public plots available or not. For more information on using 3rd party indicators, please see the help guide page here (including the Note about what functionality is or is not provided by a 3rd party indicator):


        It is possible to make an indicator that would return a value based on the account's position, though it would require use of the Account class within the indicator as mentioned by my colleague in that post you shared. More information about the Account class is listed in the help guide here, which even shows an example of how to subscribe to find a specific account that you may then use to subscribe to desired events:
        You could loop through account positions to get information as well; the Positions page shows an example that prints the position and price:
        position.MarketPosition in that example would return either long, flat, or short:
        If you want to simply check the position from a strategy, you could check Position.MarketPosition from within the strategy. This is also available in the Strategy Builder conditions in the Strategy > Current market position and Strategy > Market position options. This would only return the position for that active strategy and not for any other strategies or manually opened positions on the account.

        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Thank you for the help. I was able to get things to work in Strategy Builder with a different indicator.

          Comment


            #6
            Hi trader07, curious to know what the replacement indicator was used for that particular vendor's indicator as I have previously gone down this same path as you for backtesting purposes.

            Thanks,

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by futtrader, 04-21-2024, 01:50 AM
            4 responses
            41 views
            0 likes
            Last Post futtrader  
            Started by Option Whisperer, Today, 09:55 AM
            1 response
            12 views
            0 likes
            Last Post bltdavid  
            Started by port119, Today, 02:43 PM
            0 responses
            8 views
            0 likes
            Last Post port119
            by port119
             
            Started by Philippe56140, Today, 02:35 PM
            0 responses
            7 views
            0 likes
            Last Post Philippe56140  
            Started by 00nevest, Today, 02:27 PM
            0 responses
            7 views
            0 likes
            Last Post 00nevest  
            Working...
            X