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

Indicator Order Entry

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

    Indicator Order Entry

    Hi,

    I have been seeing some indicators that are able to place ATM orders. I had an idea for an indicator and am trying to figure out how this is achieved. Any help would be greatly appreciated!

    Thanks for your time,

    Noah
    TycheTradeing.io
    Kreyenhagen
    NinjaTrader Ecosystem Vendor - Tyche Trading

    #2
    Hello Kreyenhagen,

    Thanks for your post.

    Only a NinjaScript strategy is able to use Atm Strategy Methods to place entry orders with an Atm Strategy template (seen in Chart Trader or SuperDOM) attached to the entry orders.

    To have an indicator place trades, you would need to subscribe to the Account class and use the <Account>.CreateOrder() method to create the entry order, profit target order, and stop-loss order. Then call the <Account>.Submit method to submit orders to the account.

    The profit target and stop-loss order you create could be tied to the entry order using an OCO string as seen in the help guide.

    See the help guide documentation below for more information and sample code for Account class, <Account>.CreateOrder(), and <Account>.Submit().

    Account class: https://ninjatrader.com/support/help...ount_class.htm
    <Account>.CreateOrder(): https://ninjatrader.com/support/help...reateorder.htm
    <Account>.Submit(): https://ninjatrader.com/support/help...nt8/submit.htm

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thank you Brandon for the helpful responce!

      I have just a couple things that I am struggling to figure out.

      1) I am trying to figure out how to connect an order to the users default ATM strategy. I see there is a method AtmStrategy.StartAtmStrategy("stratageyName", order), but what do I do here if I don't know the users strategy name.

      2) I am having the same issue when subscribing to the users acount. I can subscribe to my Playback account with: account = Account.All.FirstOrDefault(a => a.Name == "Playback101"); but what if I didn't know the users account?

      Is there a way to access the infromation that is actively being utilized on the Chart Trader (Account, Instrument, Order qty, ATM Strategy)?

      Thanks again,

      Noah
      Kreyenhagen
      NinjaTrader Ecosystem Vendor - Tyche Trading

      Comment


        #4
        Hello Kreyenhagen,

        Thanks for your note.

        For an example of using Atm Strategy Templates in a NinjaScript strategy, please review the SampleAtmStrategy script that comes default with NinjaTrader. This script demonstrates placing an entry order with an Atm Strategy Template attached to control the stop and targets tied to that entry.

        To view the script, open a New > NinjaScript Editor window, open the Strategies folder, and double-click the SampleAtmStrategy.

        See this help guide page for information about available Atm Strategy Methods: https://ninjatrader.com/support/help...gy_methods.htm

        In regard to your question about Accounts, you could use a TypeConverter to get the name of an account.

        TypeConverter: https://ninjatrader.com/support/help...rattribute.htm

        See the attached example script demonstrating using a TypeConverter for the Account class.

        Let us know if we may assist further.
        Attached Files
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          I ran into a couple of things here.

          First is that the AtmSample only works with strategies, but I am trying to get this to work using an indicator. I tried creating an instace of a strategy that inherited the StrategyBase class, but I get the error stating "GetAtmStrategyUniqueId' method can only be called in state 'Realtime."

          Second is that I am still struggling to find a way to identify the name of the users account without the user having to input it. I don't want the user to have the change the indicator every time they want to trade with a differnt account, as this could easily be a forgotten step. Is there not an instance of the ChartTrader class that can be accessed to grab the necessary information?

          Thanks for all your help! It is very much appreciated!
          Kreyenhagen
          NinjaTrader Ecosystem Vendor - Tyche Trading

          Comment


            #6
            Hello Kreyenhagen,

            Thanks for your note.

            Atm Strategy Methods seen in the SampleAtmStrategy script that comes default with NinjaTrader can only be used in a NinjaScript strategy. Atm Strategy Methods cannot be used in a NinjaScript indicator.

            If you want to have a NinjaScript indicator place orders, you would need to subscribe to the Account class. Then, you would use the <Account>.CreateOrder() method to create your order and <Account>.Submit() to submit the order to that account.

            " I am still struggling to find a way to identify the name of the users account without the user having to input it."

            Please see the reference sample in post #4 which demonstrates using a TypeConverterAttribute to allow a user to select which account is used when applying an indicator or strategy to a chart.

            The user would not need to necessarily 'input' an account but instead would need to use the drop-down menu in the UI to select which account they want the indicator/strategy to use when enabling the indicator/strategy on a chart.

            See the help guide documentation below for more information and sample code.
            Account class: https://ninjatrader.com/support/help...ount_class.htm
            <Account>.CreateOrder(): https://ninjatrader.com/support/help...reateorder.htm
            <Account>.Submit(): https://ninjatrader.com/support/help...nt8/submit.htm

            Let us know if we may assist further.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              It sounds like what we're getting at is that it isn't quite possible to access the specific charts ChartTrader info to select the account/strategy the user wants. Thanks anyways, I greatly appreciate the help!

              One final question though. Is it possible to get a drop down menu for all of the users Atm Strategys, so that way they can select one rather than have to type it in?
              Kreyenhagen
              NinjaTrader Ecosystem Vendor - Tyche Trading

              Comment


                #8
                Hello Kreyenhagen,

                Thanks for your note.

                It is possible to make a control to select an Atm, but I am not aware of a way to get a list of these as strings.

                See the forum thread linked below for information about getting the selected Atm from the ChartTrader.


                And, see this forum post which contains an example of using the automation id to get the account selected in Chart Trader for a chart.


                Let us know if we may assist further.
                Brandon H.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you Brandon for sharing those with me! I have essentially completed my indicator now. I just noticed something about the UI while building it.

                  When I create an enum that the user can select a list of options from It simply displays each enum value as is. For example the enum value "StopLimit" appears as "StopLimit".

                  However, when I use one of the NinjaTrader enums this is not the case. For example the NinjaTrader.Cbi.OrderType enum has a value "StopLimit" appear as "Stop Limit".

                  How do I make my enums look like this? I tried playing around with [Display(Name=")] but that seemed to have no effect. I also tried playing around with [TypeConverter(typeof(CoreEnumConverter))] but this was also ultimately met with failure.
                  Kreyenhagen
                  NinjaTrader Ecosystem Vendor - Tyche Trading

                  Comment


                    #10
                    Hello Kreyenhagen,

                    Thanks for your note.

                    You could use a TypeConverter to determine how the name of the enum is displayed.

                    See the reference sample, SampleIndicatorTypeConverter, in this help guide link for an example of how this could be done: https://ninjatrader.com/support/help...r_to_custo.htm

                    Let us know if we may assist further.
                    Brandon H.NinjaTrader Customer Service

                    Comment


                      #11
                      Absolutely wonderful! That sample indicator is great help.

                      I know I keep saying I've got one more question, but I have though of something else if you don't mind me asking...

                      With NinjaTraders Hot Keys it's easy to record which keys the user wants to utilize to activate a specific ask. Is there a way to set this up with an indicator parameter. For example the user has to record a single key press that will be used trigger an event through the indicator.

                      Thanks for all your help Brandon!
                      Kreyenhagen
                      NinjaTrader Ecosystem Vendor - Tyche Trading

                      Comment


                        #12
                        Hello Kreyenhagen,

                        Thanks for your note.

                        At this time it would not be possible to accomplish this in a NinjaScript.

                        We are currently tracking interest for NinjaScript Support for Custom Hot Keys and I have added your vote.

                        The internal tracking number for your feature request is SFT-2669. Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

                        When a feature request is implemented, you'll find a description of the new feature in the release notes:Let us know if we may assist further.
                        Brandon H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by andrewtrades, Today, 04:57 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by chbruno, Today, 04:10 PM
                        0 responses
                        6 views
                        0 likes
                        Last Post chbruno
                        by chbruno
                         
                        Started by josh18955, 03-25-2023, 11:16 AM
                        6 responses
                        436 views
                        0 likes
                        Last Post Delerium  
                        Started by FAQtrader, Today, 03:35 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post FAQtrader  
                        Started by rocketman7, Today, 09:41 AM
                        5 responses
                        19 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Working...
                        X