Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM Strategy settings in Automated Strategy

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

    #16
    Hi TxChristopher,

    Yes, it will show errors from any strategy or indicator whenever you compile. You can resolve these errors or delete the offending script through Tools > Edit NinjaScript > Strategy menu.
    Ryan M.NinjaTrader Customer Service

    Comment


      #17
      True but the check to see if an order already exists is the problem, and it is a check that is needed so that the conditions don't get met over and over and over via the price moving and causing a gazillion orders to be entered for the same event.

      Is "if (OrderId.Length == 0" a valid method to check? The compiler seems to think it is not.

      Comment


        #18
        It's valid if OrderId is something you declared previously. You could see this page for basic C# syntax which includes variable declaration.

        http://www.ninjatrader.com/support/h...sic_syntax.htm

        If you want to work off the existing ATM sample, best would be saving a copy. Open up SampleAtmStrategy from Tools > Edit NinjaScript > Strategy menu. Then Right Click > Save as and provide a new name. You can customize it and this sample will already have the OrderId checks.
        Last edited by NinjaTrader_RyanM1; 07-20-2012, 01:37 PM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #19
          I see now, I found the variable section up top, it was collapsed and defines that variable. It was frustrating me because it seemed this variable was coming from nowhere.

          Comment


            #20
            Originally posted by TxChristopher View Post
            I see now, I found the variable section up top, it was collapsed and defines that variable. It was frustrating me because it seemed this variable was coming from nowhere.
            Hello, TxChristopher, did you resolve the problem? Im workig on making my own automated strategy, but im running with a lot of pronlems, can you please share the final code please, so i can get my automated system running, thank you very much.

            Comment


              #21
              Hello [email protected],

              Thank you for your post and welcome to the NinjaTrader Support Forum!

              Our platform support team can help you with any questions you may have on implementing ATM Strategy methods and functions into your strategy. Please provide detail on the items you are seeing in your own code so we may provide further assistance.

              Comment


                #22
                Am I correct that the example SampleAtmStrategy included with NT checks to see if there is already an ATM in play, and if so, will not execute a new position/ATM? That's not what I want to do and I don't see an example of what I truly want to do.

                If I have an order in play with an ATM and a setup occurs that would suggest reversing the position, I want to exit the existing position and execute the new position. So for instance if I have a short position in play, instead of doing the orderI.Length and atmStrategyId.Length check etc etc, can I instead code my action steps for a long position as ExitShort then ATMStrategyCreate? Or could I end up with timing issues where the new order tries to execute before the old is closed or issues when I don't actually have an existing short to exit?

                Comment


                  #23
                  Hello vickisb,

                  Thank you for your post.

                  You are correct that the SampleAtmStrategy checks for an existing ATM Strategy. We have a reversal example available on the Support Forum at the following links:

                  Please let me know if you have any questions.

                  Comment


                    #24
                    Thank you so much! Exactly what I needed.

                    Two more questions:

                    1) what is the 'Cbi' in Cbi.OrderAction.Buy and what does it do? The reference makes no mention of Cbi that I can find.

                    2) can I set up a variable/input/parameter for the Atm Strategy Template (let's say I call it AtmStrategy) so different templates can be called when executing the strategy (by simply changing the parameter without changing the strategy code) by using the code:
                    AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, longOrderId, AtmStrategy, longAtmId);
                    (Note no quotes around AtmStrategy)

                    Vicki

                    Comment


                      #25
                      Hello vickisb,

                      Thank you for your response.

                      Cbi stands for Common Broker interface. It calls functions internal to the core structure of NinjaTrader for the Accounts, Positions, Orders, etc.

                      You can in fact create a string parameter that is a user defined input. You can then use this for your strategy. Please refer to the following link for more information: https://ninjatrader.com/support/foru...84&postcount=1

                      Please let me know if you have any questions.

                      Comment


                        #26
                        I have copied the NT8 SampleAtmReversal strategy to a new name, entered the same conditions that I use for a non-ATM strategy (which has simple trailing stop and take profit levels), of course deleting the condition that came with the sample, with the only other change being that I set the AtmStrategy as an input parameter. Yet, when I run the ATM strategy on CL 03-18 for 1/25/18, I only get one trade, whereas when I run the non-atm version, I get that trade plus additional trades later in the day, which is what I expect. The Atm strategy trade is closed by the time the new setups occur, so I'm not sure what is causing it to not take the later trades.What am I missing?

                        Additionally, I have the data series Plot Executions parameter set to Text and Marker. When I run the non-ATM strategy, the trades are plotted, but when I run the ATM version, they are not.
                        Attached Files
                        Last edited by vickisb; 01-28-2018, 10:33 AM.

                        Comment


                          #27
                          Hello vickisb,

                          Thank you for your patience.

                          I will review these files and follow up with you as soon as possible.

                          Comment


                            #28
                            Thanks. Another question. I have another strategy that sets Take Profit and fixed Stop Loss levels to 20 ticks. My intention is to manage the trade manually once executed, but when I move the levels on the chart while in a trade, the platform/strategy often moves them back to the original levels. Is that supposed to happen? And if so, how do I accomplish what I'm wanting?
                            Attached Files
                            Last edited by vickisb; 01-30-2018, 07:51 AM.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by kawalecld, Today, 12:21 PM
                            0 responses
                            1 view
                            0 likes
                            Last Post kawalecld  
                            Started by farzibopsu, Today, 11:52 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post farzibopsu  
                            Started by exjayess, Today, 11:04 AM
                            1 response
                            9 views
                            0 likes
                            Last Post NinjaTrader_ShawnB  
                            Started by robertlaub, Today, 11:11 AM
                            1 response
                            3 views
                            0 likes
                            Last Post NinjaTrader_ShawnB  
                            Started by sdauteuil, Today, 10:28 AM
                            0 responses
                            6 views
                            0 likes
                            Last Post sdauteuil  
                            Working...
                            X