Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit order overfilled

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

    #16
    I just made 2 mistakes on my explanation. This is the right one (changes in red):

    -----------------------------------------------------------
    hbMilles,

    THe code I added to my strategy to avoid overfilling is disseminated along the strategy. Better than doing this I will explain my solution as a pseudo-code

    THe scenario that produced the error was:
    - I launch an EnterLongLimit() to open a position.
    - On the next bar I launch an ExitLongLimit() order to set a sort of stop profit target.
    - If, when launching the ExitLongLimit() order, the EnterLongLimit() wasn't completely filled and a new partial fill came after this point this caused the error.

    Following the instructions of the customer service the rule to follow to avoid this problem is to never have two active limit orders competing at the same time.

    So, I had to change the code to avoid the EnterLongLimit() and the ExitLongLimit() orders being active at the same time.

    The new steps to do the same are:
    1- I launch an EnterLongLimit() to open a position.
    2- I set two conditions and one of them must be accomplished before launching the ExitLongLimit() order.
    -- First condition: the order must be filled. For this I use IOrder handling (http://www.ninjatrader-support.com/H...de.html?IOrder)
    -- Second condition: I'm never sure that an order will be completely filled. To solve this I wait a prudential number of bars and then I cancel the EnterLongLimit() order. This code could be useful: http://www.ninjatrader-support.com/H...ml?CancelOrder
    3- After one of these conditions are accomplished I cancel EnterLongLimit() order and I can launch the ExitLongLimit() order without creating an overfill issue.

    Hope it helps
    -----------------------------------------------------------

    Comment


      #17
      guillembm, thank you for your explanation of how you solved this issue.
      AustinNinjaTrader Customer Service

      Comment


        #18
        guillembm,

        thanks - I really appreciate your feedback & it helped very much.
        hbmiles2000

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, Today, 07:05 PM
        0 responses
        7 views
        0 likes
        Last Post ETFVoyageur  
        Started by Orion815, 05-02-2024, 08:39 AM
        2 responses
        18 views
        0 likes
        Last Post Orion815  
        Started by suroot, 02-25-2017, 04:43 AM
        11 responses
        2,552 views
        0 likes
        Last Post Zilvercat  
        Started by Rogers101, 05-05-2024, 11:30 AM
        16 responses
        50 views
        0 likes
        Last Post Rogers101  
        Started by ninza33, Today, 12:31 PM
        2 responses
        12 views
        0 likes
        Last Post ninza33
        by ninza33
         
        Working...
        X