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

Stop market order for stop loss submitted by NinjaScript-created ATM strategy

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

    Stop market order for stop loss submitted by NinjaScript-created ATM strategy

    Hi,

    I have the following problem: I create an ATM strategy using NinjaScript ("NS") and set "Use stop market for stop loss orders" to "True" under dynamic DOM. When I execute the NS and the entry order is triggered, the stop loss order is submitted as a stoplimit order (which seems to have a default limit price of 20 ticks away from stop price), instead of a stop market order.

    However, when I execute the same ATM strategy manual in DOM, the stop loss order is correctly submitted as a stop market order.

    The above setup/bug is carried out under Simulated Data Feed with the following NS code:

    AtmStrategyCreate(isLong ? Action.Buy : Action.Sell, OrderType.StopLimit, limitPrice, stopPrice, TimeInForce.Gtc, orderID, atmTemplate, atmID)


    I have tried using "OrderType.Stop" in the above method but to no avail.

    Any help will be much appreciated.


    Many thanks,

    Wilson

    #2
    cyrotiv,

    From a NS strategy, the OrderType does not influence the ATM strategy. That just determines the order type for your entry order.

    Please provide a screenshot of your Control Center with the stop order as submitted by your NS strategy. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      cyrotiv,

      From a NS strategy, the OrderType does not influence the ATM strategy. That just determines the order type for your entry order.

      Please provide a screenshot of your Control Center with the stop order as submitted by your NS strategy. Thank you.
      Hi Josh,

      As requested, please see the attached screenshots before and after the NS-created ATM entry order trigger.

      Thanks,
      Wilson
      Attached Files

      Comment


        #4
        cyrotiv,

        That would be your entry order and not your stop-loss order no? This looks accurate as the order type was chosen to be stop-limit. Or am I misunderstanding something here?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          The thing is, I wanted to use a stop market order for my stop loss hence I set the "Use stop market for stop loss orders" to True; the entry order just happens to a stop limit order which can be a limit or market order as well. For clarity, I listed down in steps what I did.

          1. Set the "Use stop market for stop loss orders" to True
          2. Enter 2 stop loss and respective profit targets in an ATM template I've created
          3. Create an ATM entry order with AtmStrategyCreate(...) in NS
          4. Trigger the entry order
          5. I ended up with 2 limit orders (profit targets) and 2 stop loss stop limit orders as shown in the screenshot. However, I wanted stop market orders instead of stop limit orders for my stop loss.

          The funny thing is, if I use the same ATM template and manually activate the ATM entry order, I will end up with stop market orders for my stop loss.

          Hence, my question is, how do I achieve the same behaviour using NS to activate ATM?

          The initial problem I wanted to solve is to close an ATM strategy or cancel an ATM entry order when the market hits a certain price. I understand from my asking of support@ninjatrader and the NT help manual that I would have to invoke ATM from NS in order to achieve this. This introduces the above problem unless we go down the IOrder route to explicitly handle order submission through NS, instead of ATM. But this does not detract from the discrepancy in stop loss order handling between using ATM manually or using NS to activate ATM.

          Hope the above helps in your answering my query. Thanks!

          Comment


            #6
            Hi Josh,

            I came across a similar thread here but the problem described therein is dependent on the exchange. FYI, the instrument, exchange and broker which I intend to use NS/ATM to trade accepts stop market order.

            Hope this helps.

            Comment


              #7
              cyrotiv, this is hard coded for StopLimit on Globex on NinjaTrader 6.5

              In our upcoming NinjaTrader 7 you can toggle between StopLimit and StopMarket orders, except on Ecbot / Eurex and FX spot products.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Perr0Grande, Today, 08:16 PM
              0 responses
              2 views
              0 likes
              Last Post Perr0Grande  
              Started by elderan, Today, 08:03 PM
              0 responses
              5 views
              0 likes
              Last Post elderan
              by elderan
               
              Started by algospoke, Today, 06:40 PM
              0 responses
              10 views
              0 likes
              Last Post algospoke  
              Started by maybeimnotrader, Today, 05:46 PM
              0 responses
              12 views
              0 likes
              Last Post maybeimnotrader  
              Started by quantismo, Today, 05:13 PM
              0 responses
              7 views
              0 likes
              Last Post quantismo  
              Working...
              X