• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM Stop Market Orders

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

    ATM Stop Market Orders

    Hi Guys, I am calling up ATM strategies using the following:

    AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, GetCurrentBid(), 0,TimeInForce.GetTypeCode, orderId1, atmname, atmStrategyId1);

    All works ok apart from the fact that once the order is filled the stop is always showing as StopLimit instead of StopMarket. I'd like it to be a Market order.

    I have stop market orders set as default in both the DOM and chart trader and resaved the strategy with Use stop market for stop loss orders set to true. Any ideas on how to achieve this?

    Thanks
    DJ

    #2
    Hello dj,

    Unfortunately there is not an argument to submit the exit stop order as stop market when using an ATM Strategy method.

    If you would like protective stop orders as stop market, you would need to use ExitLongStop or ExitShortStop and specify the order type there.

    Adding this functionality is on our development team's list under ID # 1218
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks Matthew, so how would I do this then using the SampleATMstrategy? I see this section but all I want is the standard stop of say 20 ticks?

      Thaks
      DJ

      if (atmStrategyId.Length > 0)
      {
      // You can change the stop price
      if (GetAtmStrategyMarketPosition(atmStrategyId) != MarketPosition.Flat)
      AtmStrategyChangeStopTarget(0, Low[0] - 3 * TickSize, "STOP1", atmStrategyId);

      Comment


        #4
        Hello,

        When using the ATM Strategy, the limit offset will always be 20 ticks. This is hard coded and cannot be changed.
        MatthewNinjaTrader Product Management

        Comment


          #5
          ATM Market Stop

          Hi Matthew, sorry if I wasn't clear. Do you have an example to change the ATM StopLimits to StopMarket using say the ExitShortStop command you mentioned. I'm not seeing anything in the manual about this in respect of ATM strategies...

          So I have this right now in may atm strategy:

          AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, GetCurrentBid(), 0,TimeInForce.GetTypeCode, orderId1, atmname, atmStrategyId1);

          The atm strategy atmname contains a 20 tick stop. So how do I use this ExitShortStop command?

          Thanks
          DJ

          Comment


            #6
            Dj,

            Sorry for the confusion - you cannot use an ExitLongStop or ExitShortStop with an ATM Strategy method.

            If you prefer to use stop market orders, you will need to program your own ATM Strategy logic. Please see our Reference Sample on Using OnOrderUpdate() and OnExecution() methods to submit protective orders: http://www.ninjatrader.com/support/f...ead.php?t=7499

            There reference sample uses 'SetStopLoss', however this order type will also be stop limit order.

            Please also review our Help Guide on ExitLongStop (http://www.ninjatrader.com/support/h...erlongstop.htm) and ExitShortStop (http://www.ninjatrader.com/support/h...tshortstop.htm)
            MatthewNinjaTrader Product Management

            Comment


              #7
              MarketStop ATM orders

              Hi Matthew, thanks for the link below but am still confused/concerned and would appreciate some clarification/guidance.

              1. StopLimit

              Assuming I'm in a swing trade and overnight we have another flashcrash. Based on the status quo if I use stoplimit in my automated ATM strategy the system may blow through my stop to the extent of no more than 20 ticks? After 20 ticks less than the stoplimit assuming a long trade it will automatically close me out?

              At this point I'm seeing the inability to set a market stop as a major limitation to using automated ATM strategies. The fact that you can set default marketstops in charttrader and the DOM but cannot set them in automated ATM strategies could be quite an issue. If anything the default setting should have been marketstop. I'm sorry to rant on but I've spent quite a few weeks developing and testing ATM strategies and only noticed the StopLimit order issue yesterday. I know the development team must be extremely busy but do you have any idea when this issue will be addressed ?

              2. Workaround

              I've reviewed the sampleonorderupdate strategy and am still confused on how to take a snippet of this code and process a market stop order for my automated ATM strategy. Any further guidance on this would be appreciated.

              Cheers
              DJ

              Comment


                #8
                Hi DJ,

                Sorry if there's any confusion. I'll try to sum up everything mentioned so far:
                You cannot specify stop market orders for ATM strategies placed with NinjaScript. It's not currently available, but is noted as a feature request with tracking ID # 1218. We unfortunately cannot offer a commitment or a date when it would be implemented.

                The limit offset is 20 ticks worse than the stop price, so once it triggers, it should be marketable and you will get filled almost every time. Situations like the flash crash are extremely rare but it's understandable that you would like to be prepared.

                If you want your protective orders placed as stop market, you would need to use a standard NinjaScript strategy ( rather than an ATM based one) with the methods ExitLongStop() and ExitShortStop().
                Last edited by NinjaTrader_RyanM1; 12-07-2011, 05:58 PM.
                Ryan MNinjaTrader Customer Service

                Comment


                  #9
                  ATM Loss protecton

                  Thanks Ryan for clarifying the offset. One can never be too prepared when trading futures. As another backstop I have added the following to my code so I am out after a $500 realized loss is triggered. This is working correctly in testing. What I want to do is increase the loss number so it triggers below the maximum offset number. The problem is when I look at the orders tab the resulting sell order from the GetAtmStrategyUnrealizedProfitLoss is in fact a limit order and not a market order. I would have thought it should be a market order?

                  Am I missing something with all of this?

                  Thanks in advance
                  DJ

                  if(atmStrategyId1.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId1) != Cbi.MarketPosition.Flat&&GetAtmStrategyUnrealizedP rofitLoss(atmStrategyId1) <= -500)
                  {
                  AtmStrategyClose(atmStrategyId1);
                  AtmStrategyCancelEntryOrder(orderId1);
                  atmStrategyId1 = string.Empty;
                  }

                  Comment


                    #10
                    DJ,

                    Does a target order exist around this time?

                    When using ATMStrategyClose(), it will first attempt to modify your existing target (limit order) to market to be filled. If no target exists, it will submit an order at market.

                    Please see our Help Guide article on this method for more information:

                    http://www.ninjatrader.com/support/h...ategyclose.htm
                    MatthewNinjaTrader Product Management

                    Comment


                      #11
                      ATM Stop Limit Order Risks

                      Hi Matthew, I have plodding along and testing the ATM issue and at this point it appears ATMs are too risky to trade live due to stops being stoplimit and not stopmarket.

                      For example last night I left a trade running on GC in sim (see the first chart). I got up in the morning and the feed was disconnected due to an internet outage.

                      The problem was obvious in the stoplimit had been blown through and I was down over $1200. Now, if you look at the second chart of orders you can see GC had 2 working stoplimit orders of 1613.8 suggesting they had been triggered but blown through.

                      Now my understanding based on what Ryan said earlier the limit column to the left of 2 orders at 1611.8 was the 20 tick final line of defense (please correct me if I am wrong) but this had not been triggered either which is concerning. This isn't an isolated case either, about 25% of my trades were in this boat. Ideally this can be rectified asap.

                      So in short I am looking for a workaround on this to protect against these risks. I like ATM strategies compared to the normal ones because you have flexibility to move targets at will on chart trader while the ATR stop continues to move whereas the normal strategies you can't.

                      Anyway, I started using AtmStrategyClose as a second line of defense and also AtmStrategyUnrealizedProfitLoss as a third line of defense. This seems to be partially successful in that is closing but the problem is I am sometimes getting a naked 2 contract position with no stop or target and the term "Close" in the Name column.

                      For example, if I am in a long and the ATR flips then it close so not sure why it would do this. Instead it places another order. Here is the code:

                      if(atmStrategyId1.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId1) == Cbi.MarketPosition.Long


                      &&Close[0]<ATR
                      // &&onlyonce== false
                      )
                      {
                      AtmStrategyClose(atmStrategyId1);
                      AtmStrategyCancelEntryOrder(orderId1);
                      // onlyonce=true;
                      atmStrategyId1 = string.Empty;
                      }

                      I tried to put this onlyonce part in which I found in another thread on this issue but then the ATMStrategyClose didn't work at all. I am using COBC=false but I am not sure this should make any difference as the moment the

                      Here is the stop mod code I'm using:

                      AtmStrategyChangeStopTarget(0, ATR "STOP1", atmStrategyId1);
                      AtmStrategyChangeStopTarget(0, ATR, "STOP2", atmStrategyId1);


                      So any ideas on why this 2 contract position naked position would be occurring based on the above code would be appreciated? I am happy to send the entire file to you if that would help.

                      Thanks in advance
                      DJ

                      ps Note I am not getting any errors in the log but as you see on the third attachment I had lost connection. When I reconnected this morning should this have closed on reconncetion at the stoplimit price?
                      Attached Files
                      Last edited by djkiwi; 12-22-2011, 12:34 PM.

                      Comment


                        #12
                        DJ,

                        From your screen shots, it looks like these were Sim101 orders - is that correct? In what you experienced this morning was that from the simulation account?
                        MatthewNinjaTrader Product Management

                        Comment


                          #13
                          Sim account

                          Hi Matthew, yes this is sim.

                          Comment


                            #14
                            In the simulation account, these orders are not resting on an external server. This means if NinjaTrader is not running or not connected to the internet, there is no way for these trades to be managed.

                            The same scenario would not occur in a live account since the physical orders are held either on the broker's servers or the exchange. This would allow your position to remain protected even if NinjaTrader not running. However please note that even on a live account, the OCO (once cancels other) functionality will be simulated on your local PC and would require NinjaTrader to be connected for this part to work.


                            Please review our post on Order Location for further clarification:

                            http://www.ninjatrader.com/support/f...7076#post27076
                            MatthewNinjaTrader Product Management

                            Comment


                              #15
                              Orders

                              Hi Matthew, thanks for clarifying as I didn't realize it. Please clarify what this means.

                              OCO (One Cancels Other) functionality is simulated on your local PC.

                              So assuming I am in that trade of GC with the following and my connection goes down:

                              2 x limit based targets
                              2 x ATR stops

                              I am using Zenfire what specifically happens to these orders during the outage? Are they all ignored until reconnection?

                              Thanks
                              DJ

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by williamzz, Today, 09:50 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post williamzz  
                              Started by Steve L, Today, 05:01 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Steve L
                              by Steve L
                               
                              Started by Trader-Joe, Today, 04:06 PM
                              1 response
                              14 views
                              0 likes
                              Last Post NinjaTrader_ShawnB  
                              Started by vantojo, Today, 04:06 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post vantojo
                              by vantojo
                               
                              Started by tonynt, Today, 02:39 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post tonynt
                              by tonynt
                               
                              Working...
                              X