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

Ninjatrader Strategy Builder and connecting ATMs

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

    Ninjatrader Strategy Builder and connecting ATMs

    I use Strategy Builder to build most of my trading strategies.

    I rarely need to unlock the code because then I can not open the code again using Strategy Builder.

    Here is what I am looking for:

    1. To find out if there is a creative way to connect/point any of my ATMs to my Strategies using the Strategies Builder only and how? I would prefer that the parameter to show up as a drop down box selection at the start of the Strategy to where it points to the ATM folder (or to where I type in the exact name of the ATM and it will pick it up in the start of the Strategy). Similar to the My Inputs that can be adjusted upon starting the Strategy.

    2. Or, if connecting/pointing to a ATM is not possible yet with the Strategy Builder, then I after I am finished programing the strategy in the Strategy Builder, then I could unlock the code at that point and manually copy and paste the necessary code in the code to make the Strategy point to the ATM of choice. Here again, I would like the code to make a parameters window appear upon starting the Strategy (like the My Inputs) to were when a drop down box appears I can select the appropriate ATM or type in the ATM I want.

    3. Would also find out how I can add a global button(s) for different functions that show up at the top of each chart I open. For example, I would like to have a button that shows Long and Short at the top. When they are gray, then the strategy is disabled. When they are green, the strategy is enabled, connected, and no problems. When they are yellow they are connected but there is a problem with connection, no synced, etc.

    4. ...and...generally, I am looking for a Ninjatrader programmer that I can go to at times for help or assistance in doing misc. things I either need help with or done moving into the future as well...long term relationship...

    Thanks...

    #2
    Hello Birddog,

    Unfortunately it is not possible to use the strategy wizard to connect a NinjaScript strategy to an ATM strategy. We are currently tracking this suggestion with ID # 518. Thank you for the input.

    In order to do this you want to work from the provided sample. This is available with Tools > Edit NinjaScript > SampleAtmStrategy. To save a copy and work with this, open it and then Right Click > Save as to give it a new name.

    You will want to work from the sample as it has all the structure needed for successfully using ATM strategies in NinjaScript. You can create your others expressions using the strategy wizard, view code, and copy > paste these into.

    There is no support for adding custom buttons with code, although some users have been able to create these. Creating this will be on the advanced side of working in our evironment and I suggest looking at this undocumented / unsupported thread for ideas in this area.

    We have many qualified partners that can help with NinjaScript. I would take a look at the list here and start contacting a few to explain your requirements:
    Last edited by NinjaTrader_RyanM1; 05-25-2011, 10:16 AM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan,

      ------------nevermind------------i see it now....thanks...

      Can you please post the SampleAtmStrategy file as for some reason I do not have it. I have NT ver 1000.4.

      Thanks...

      Comment


        #4
        Ryan,

        Ok, so I create a new strategy with all my expressions that I want.

        Then, I go to the SampleAtmStrategy and copy entire sample.

        Then, where exactly do I paste the sample info into my strategy I created in the wizard?

        Do I paste it all at the very top or where? Or, do I have to copy and paste certain sections in certain places (if so, where)?

        Will this create a parameter so that when I start the Strategy, it will ask for the name of the ATM I want to use and or provide a drop down of selections of all the ATMs I have to choose from?

        I won't have to unlock my strategy I create in the wizard do I?

        Thanks Ryan...

        Comment


          #5
          You should understand that this sample requires working with code, and does not integrate with the strategy wizard like you are trying to do.

          First step I would take is get familiar with the workings of this sample, by identifying the entry condition and the line where your ATM strategy is specified. That's here:
          if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
          {
          atmStrategyId = GetAtmStrategyUniqueId();
          orderId = GetAtmStrategyUniqueId();
          AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId);
          }

          Entry Condition
          Name of your template.

          Play around with the sample against live data (best is the simulated data feed) so you can see how it works. Only once you can get it submitting orders and using the specified ATM strategy should you look to add additional complexity.

          You can build expressions with the strategy wizard condition builder, click view code and then copy paste these expressions into a modified SampleAtmStrategy if you want -- not the other way around. This is not simple copy-paste everything. You have to know what parts go where.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Is there any place I can see a sample code of a simple SMA crossover with an ATM entry strategy?

            I have brought both strategies up in the editor but have a hard time understanding the SampleAtmStrategy code with all it's complexities.

            Thanks,

            Comment


              #7
              There's unfortunately not a dedicated sample for this entry condition availalbe, Ryan has marked the entry in this last post for you, this would be then replaced by your custom condition, for example the SMA cross. Most of the sample complexities though would remain as this framework is needed to work with ATM's in NinjaScript code.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Bertrand,
                I’m having a hard time understanding the SampleAtmStrategy. What I’m trying to accomplish is a sample strategy I can learn from. I intent to take the crossover strategy and replace the EnterLong();and EnterShort(); command with my personal Atm strategy. Example- filled three contracts with stoploss of 8 ticks with target one 4 ticks, target two 8 ticks and trail target 3.
                Am I on the right track? Would it be easier for me to copy the code over to the SampleAtmStrategy or vice versa with the SampeMAcrossover?
                Thanks for the help.

                Comment


                  #9
                  You want to copy SampleAtmStrategy to a new one by right clicking > Save As and give a new name.

                  Then add your custom entry condition to the location indicated. Change the AtmStrategyTemplate to your custom template, created in another order entry window, like superdom.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Then add your custom entry condition to the location indicated. Change the AtmStrategyTemplate to your custom template, created in another order entry window, like superdom.
                    I have attached a picture because I'm not understanding this. Do I add my custom atm strategy template in the paramaters window or do I need to program this ATM template into my strategy?

                    Do I need to replace the EntryLong(); command with a custom code
                    "fill three contracts with stoploss of 8 ticks with target one 4 ticks, target two 8 ticks and trail target 3 when cross over happens?
                    Attached Files

                    Comment


                      #11
                      NinjaScript with ATM strategies can't use EnterLong(). Order placement takes place in that ATMStrategyCreate() method..

                      Setup your desired atm strategy using any of the order entry windows. If you're looking for help creating an ATM strategy, see the help guide link here. Once it looks the way you like: Right Click > Manage AtmStrategy Template > Provide a name.

                      Use the same name in the NS code.
                      AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "NameOfYourTemplateGoesHere", atmStrategyId);
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        Wow, got it working thank for the help.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by traderzoso, 12-27-2020, 05:19 PM
                        6 responses
                        227 views
                        0 likes
                        Last Post lekor
                        by lekor
                         
                        Started by ETFVoyageur, 05-18-2024, 12:45 AM
                        4 responses
                        26 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by Skifree, Today, 11:47 AM
                        4 responses
                        17 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by molecool, Today, 01:48 PM
                        1 response
                        4 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by ETFVoyageur, Today, 12:26 PM
                        3 responses
                        11 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X