Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM within a strategy

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

    ATM within a strategy

    We have two strategies, one that generates an ATM at market order (see code below) and this works fine. The other is for a limit order (see code at the bottom); this works ok the first couple of times but any subsequent entries go straight in without waiting for the 4 tick reversal. Any ideas please?

    AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, orderId, "ATM1",atmStrategyId )

    AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, (Close[0] - .0004), 0, TimeInForce.Day, orderId, "ATM1",atmStrategyId )

    #2
    Hello bassmanpete,

    Thank you for your post.

    You may wish to utilize TickSize in this instance. For example:
    Code:
    AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, (Close[0] - 4*TickSize), 0, TimeInForce.Day, orderId, "ATM1",atmStrategyId )
    For information on TickSize please visit the following link: http://www.ninjatrader.com/support/h...7/ticksize.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank you Patrick, that seems to have done the trick. Now I have another query. We use the ATM within a strategy so that we can enter a trade when certain conditions apply and then manage the trade manually. Moving the stop doesn't cause any problem but if the target is moved, once the trade is completed the ATM won't execute again when the same conditions are met. Any ideas on this one please?

      Comment


        #4
        Hello,

        This could be a few things,

        I wanted to first check are you resetting the atmStrategyId before the next order? if not please make sure to do this to make unique ids.

        Also does this happen if you let the strategy fill without managing the stop or target? Does it work after the condition is met with no user intervention?

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks for your response Jesse. Yes, atmStrategyId is reset. If there is no user intervention and either the stop or target is reached the ATM will enter another trade when the right conditions are met.

          Comment


            #6
            Hello,

            Thank you for the reply.

            I am unable to re create this using the SampleATMStrategy, have you tried this using the Sample strategy instead of your own to confirm this is not something logical in the current strategy?

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello again Jesse. With the use of Print statements we've found that the atmStrategyId isn't being reset after all. I don't understand this as we are using the SampleATMStrategy code in our strategy and it has worked in the past. Our strategy with the market order in was working fine until I edited the ATM and changed the stop and target. Now it enters one trade but won't enter any others as the atmStrategyId isn't being reset. How can this be? We're tearing our hair out here (not that we have much left anyway!) Also what is the difference between Cbi.OrderAction.Buy and OrderAction.Buy?

              Comment


                #8
                Hello,

                If the atmStrategyId is not being generated there may be some error in the logic in the script currently.
                As long as you have included the portion of code from the sample:

                Code:
                atmStrategyId = GetAtmStrategyUniqueId();
                and you know that this is being called, then the ID should be re generated and used.

                I am unsure without seeing the code as to what the problem is, the best solution would be to ensure this ID is being reset by using prints or other debugging methods.

                For your second question,
                Cbi.OrderAction.Buy;
                OrderAction.Buy

                These would be the same, Cbi is the namespace that OrderAction is defined in, calling just OrderAction.Buy means that the using statement of using NinjaTrader.Cbi; would be present. Otherwise if the using statement is not present, you can specify which namespace the OrderAction is in to call it.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Jesse,

                  so it seems this way it is possible to place a limit with chart-trader in a chart. And to have running then the trade within the script-strategy enabled in another chart?

                  Thank you
                  Tony

                  Comment


                    #10
                    Hello,

                    I will answer with what I have understood the question as, if this is not what you are asking please clarify your question.

                    If you are asking "can i submit a manual order using chart trader, then get the ATM id and use that in a strategy"

                    Yes this is possible but not from script, you would need to submit the order manually, copy the ATM id manually from the control center, paste it into a strategy and run the strategy.

                    If this is not what you asked please provide more details on your question.

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Hello,

                      thank you for your reply. Yes, this would be the idea. But with this handling this makes no sense.

                      But I can do it perfectly the other way, means when entering a trade with script-strategy and then manage the stops with chart-trader.

                      Can this be that one can enter with script and then handle the stops in chart trader but one can not enter with chart trader and then manage the trades with script?

                      Thank you
                      Tony



                      Originally posted by NinjaTrader_Jesse View Post
                      Hello,

                      I will answer with what I have understood the question as, if this is not what you are asking please clarify your question.

                      If you are asking "can i submit a manual order using chart trader, then get the ATM id and use that in a strategy"

                      Yes this is possible but not from script, you would need to submit the order manually, copy the ATM id manually from the control center, paste it into a strategy and run the strategy.

                      If this is not what you asked please provide more details on your question.

                      I look forward to being of further assistance.

                      Comment


                        #12
                        Hello,

                        The ATM strategies being used in a NinjaScript strategy were not meant to be used this way.

                        You are correct, you can manually modify the orders you see in the chart trader but the other way around would not really be possible.

                        As I said previously, you could potentially copy and paste and do the manual actions to start a strategy and use the existing ID from what you manually submitted but that really defeats the purpose of using an ATM strategy or a strategy.

                        What you are trying to do is really not possible in NinjaTrader using the tools available, ATM strategies are meant to be a semi automatic method of trading from the DOM, where NinjaScript strategies are meant to be fully automatic and do not need a specific window to trade.

                        When you mix the two this really limits the capabilities of the script because they are two completely different methods of trading.

                        The ATM strategy from within a NinjaScript strategy was really just meant to allow you to modify the stop parameters from an easy to use ATM strategy menu, and have it used to control the protective orders instead of writing logic in your strategy to accomplish this.

                        For any sort of manual trading, a NinjaScript strategy is not really recommended as this is meant to trade for you without the need for your intervention.

                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by cre8able, Today, 01:16 PM
                        2 responses
                        9 views
                        0 likes
                        Last Post cre8able  
                        Started by chbruno, 04-24-2024, 04:10 PM
                        3 responses
                        48 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by samish18, Today, 01:01 PM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_LuisH  
                        Started by WHICKED, Today, 12:56 PM
                        1 response
                        9 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by WHICKED, Today, 12:45 PM
                        1 response
                        11 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X