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

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 frankthearm, Yesterday, 09:08 AM
        12 responses
        43 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by junkone, Today, 11:37 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        35 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        35 views
        0 likes
        Last Post love2code2trade  
        Working...
        X