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

WHen exactly can I enter a stop order for a new position?

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

    WHen exactly can I enter a stop order for a new position?

    When please can I enter stop orders for opened positions?

    Look at this trace. It contains information from your order update as well as a dump of all orders i get on the OnOrderUpdate method:

    24/07/2009 10:34:53 Entered internal PlaceOrder() method at 24/07/2009 10:34:53: Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='HA1 S' FromEntrySignal=''
    ONOD: Order='NT-00000/Sim101' Name='HA1 S' State=PendingSubmit Instrument='YM 09-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='HeinekenAshiReversal' Type=Market Tif=Gtc Oco='' Filled=0 Fill price=0 Token='dd571aa47141409987e153d5e736b998' Gtd='01/12/2099 00:00:00'
    ONOD: Order='NT-00000/Sim101' Name='HA1 S' State=Accepted Instrument='YM 09-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='HeinekenAshiReversal' Type=Market Tif=Gtc Oco='' Filled=0 Fill price=0 Token='dd571aa47141409987e153d5e736b998' Gtd='01/12/2099 00:00:00'
    ONOD: Order='NT-00000/Sim101' Name='HA1 S' State=Working Instrument='YM 09-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='HeinekenAshiReversal' Type=Market Tif=Gtc Oco='' Filled=0 Fill price=0 Token='dd571aa47141409987e153d5e736b998' Gtd='01/12/2099 00:00:00'
    ONOD: Order='NT-00000/Sim101' Name='HA1 S' State=Filled Instrument='YM 09-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='HeinekenAshiReversal' Type=Market Tif=Gtc Oco='' Filled=1 Fill price=9028 Token='dd571aa47141409987e153d5e736b998' Gtd='01/12/2099 00:00:00'
    24/07/2009 10:34:53 Entered internal PlaceOrder() method at 24/07/2009 10:34:53: Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=9044 SignalName='HA1 STP' FromEntrySignal='HA1 S'
    24/07/2009 10:34:53 Ignored PlaceOrder() method: Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=9044 SignalName='HA1 STP' FromEntrySignal='HA1 S' Reason='This was an exit order but no position exists to exit'

    Why the hell is my command to enter a stop order IGNORED when the preceding order was filled?

    All my processing happens in the OnOrderUpdate event. I can not use the OnExecution event, because - i clean out completed orders out of my management. So, by the time OnExecution runs, i dont even know the order anymore in my trade manager.

    Anyone has a STATE DIAGRAM? Flow Diagram? Some proper documentation how that all is supposed to work together or a way to enter orders withhout your rotten logic silently ignoring it?

    I spent the whole weekend trying to get sensible event driven order management in, because while you do signal based position tracking, you do not expose it to the user, so I need to replace the whole stuff. Now I am still stuck with what should be a job I should not even have to do.

    3 days later, and still orders just get ignored.

    #2
    NetTecture, which order type did you exactly place to protect your open Short position? Did you check for the orderstate to be reported as filled before you placed it?

    There's unfortunately not 'flow diagram' but to review the 'Internal Order Handling Rules' we use please check into the bottom section of this link - http://www.ninjatrader-support.com/H...helpguide.html

    In NinjaTrader 7 you can manage this all individually without those rules if you choose to do so - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html

    New Unmanaged Order Submission
    In 6.5 some users were burdened with our "Internal Order Handling" rules. We have introduced unmanaged order submission which bypasses the convenience of our order handling layer. This lower level of programming allows you to do what you want relative to order submission/management without any limitations other than any imposed by your broker. There are only three methods, SubmitOrder(), ChangeOrder() and CancelOrder(). You then get the flexibility of managing your orders how you see fit and optionally handling rejections.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      NetTecture, which order type did you exactly place to protect your open Short position? Did you check for the orderstate to be reported as filled before you placed it?

      There's unfortunately not 'flow diagram' but to review the 'Internal Order Handling Rules' we use please check into the bottom section of this link - http://www.ninjatrader-support.com/H...helpguide.html

      In NinjaTrader 7 you can manage this all individually without those rules if you choose to do so - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html

      New Unmanaged Order Submission
      In 6.5 some users were burdened with our "Internal Order Handling" rules. We have introduced unmanaged order submission which bypasses the convenience of our order handling layer. This lower level of programming allows you to do what you want relative to order submission/management without any limitations other than any imposed by your broker. There are only three methods, SubmitOrder(), ChangeOrder() and CancelOrder(). You then get the flexibility of managing your orders how you see fit and optionally handling rejections.
      Yes. I must say, though, that I have only two problems with those rules:
      * Error message mostly make no sense. "Ignored by the rules" is not an error message.
      * I miss a way to enter orders that never get closed and dont show up in the performance log. I suppose this also wont be possible. Now, when you ask for why I need it.... RUNAWAY EXECUTIONS - when I cancel an order, and still get a fill, I can identify that in the code, but i can not dump the position ;(

      Comment


        #4
        NetTecture, unfortunately inflight executions are one of the electronic trading risks. However, what I don't understand is this: when you get an execution, you should get a position reported in, so if you have logic in place to guard you against those inflight executions, you should be able to manage it in your code.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I cant.

          Problem is - how do I manage against this? Your API forbits it.

          * I get a "surplus" fill for a long entry position. Now, I have one contract long more than my signals indicate.

          How do I get rid of that thing? It lived outside of your signal world. I have no API to say "sell 1 contract, and shut up, it is not part of a trade, it will NOT GET CLOSED OUT EVER".

          THis is the main problem. I have code now to find "outdated fills". I track all orders until they are reported in an end state. This rules out "late fills" to get lost. Basically, when I cancel the order, it is still iny my list of tracked orders, and my trade manager knows at the same time this fill does not belong to any position I track.

          The problem I have is: if I cancel an order, then from this moment on the position in your management and mine is closed. I get a late fill..... HOW DO I GET RID OF THE CONTRACT?

          Simple: Sell it at market.

          Problem: I can not do so without a new signal, which is going to **** up my reporting, and... this signal will get closed when I stop the strategy.

          What I need is a way to enter a trade order "outside" of that. And/or a way to report that to the user in a VISIBLE METHOD (hey, sell one NOW, dude).

          Both not possible. Or - enlight me.

          Comment


            #6
            Why do you feel you can't see it? If you get an execution you get an OnExecution event.

            Not following you on your "sell 1 contract, and shutup". If you received a long fill, place a sell order. If you received a short fill, place a buy to cover.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Austiner87, Today, 03:42 PM
            1 response
            18 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by cshox, Today, 11:11 AM
            2 responses
            16 views
            0 likes
            Last Post cshox
            by cshox
             
            Started by algospoke, Today, 06:53 PM
            0 responses
            11 views
            0 likes
            Last Post algospoke  
            Started by mlprice12, 12-21-2021, 04:55 PM
            3 responses
            298 views
            0 likes
            Last Post paypachaysa  
            Started by lorem, 04-25-2024, 09:18 AM
            20 responses
            87 views
            0 likes
            Last Post lorem
            by lorem
             
            Working...
            X