• 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

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 wbennettjr, Today, 11:18 AM
        0 responses
        3 views
        0 likes
        Last Post wbennettjr  
        Started by Induna, Today, 05:38 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by Alfred, Today, 10:20 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by emuns, Today, 10:34 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by swcooke, Yesterday, 10:39 PM
        4 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jim  
        Working...
        X