Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Repeated order submission calls sampleOnOrderUpdate

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

    Repeated order submission calls sampleOnOrderUpdate

    Hello,

    I've noticed that in the updated strategy sample sampleOnOrderUpdate for NT8 ExitLongStopMarket and ExitLongLimit for "MyStop" and "MyTarget" respectively are potentially called again for OrderState.Filled if previously called for OrderState.PartFilled. Should ChangeOrder be called if previously submitted/accepted/working for PartFilled? If called as done in the example, are they updating the previous logical orders or creating new logical orders? If we're tracking these orders via Order objects, do they need to be updated or OK to keep them to the initial pointer assignments during the first pass through OnOrderUpdate?

    Thanks,
    Silverm3170

    #2
    Hello silverm3170,

    In the sample it is using signal names so this will just amend the orders if there is a partial fill. You can also use ChangeOrder if you wanted as this sample demonstrates using Order objects, calling the entry method again is also acceptable. You can see in the OnBarUpdate where the stop order is being updated to breakeven, this is a similar concept to what is happening in OnOrderUpdate with the partial fill, it is just being updated for the partial fill or fill.

    You don't necessarily need to reset the variable each time you call the same order method however we do suggest doing that for good practice, this will result in uniform syntax by doing so. As long as you store your order variable once you could use that later for change order or other order tasks. Once you are done with the order make sure to set it to null to complete the logic.



    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      I see. Thanks Jesse. So you're reassigning the order object again via the return call, i.e. stopOrder = Exit....

      Comment


        #4
        Hello silverm3170 ,

        Right, a note about that. In the sample we show the object being returned from the order method however it is generally suggested to instead assign the order objects how the entry is handled in that script. Or more specifically to observe the OnOrderUpdate/OnExecutionUpdate and then assign the variable from that point. This ensures the order was successful and has a valid state before it starts to get used in your logic. The sample is very simple so that is not really needed there and only the entry displays using this approach.


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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NeverDownMoney, Yesterday, 04:21 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by wjadevries, Today, 12:58 AM
        0 responses
        7 views
        0 likes
        Last Post wjadevries  
        Started by JoeyBoy, Yesterday, 04:05 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by bruhnrp, Yesterday, 05:56 PM
        2 responses
        15 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by NtFan, 04-10-2020, 04:05 PM
        5 responses
        58 views
        0 likes
        Last Post jeronymite  
        Working...
        X