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

Duplicate orders from a strategy

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

    Duplicate orders from a strategy

    Hi

    Last night for the first time in 7 months, my strategy placed duplicate entry orders and I would like clarification of my understanding before I make a change, please.

    With the managed approach to entry orders, "By default, orders submitted via Entry() and Exit() methods automatically cancel at the end of a bar if not re-submitted".
    I am using "entryOrder1 = EnterShort( nContracts1, entryName1 );"
    Within OnExecution(), I set a flag to prevent the entry order code running again if the entry order is executed.
    CalculateOnBarClose = false;
    EntriesPerDirection = 3;
    EntryHandling = EntryHandling.UniqueEntries;
    TimeInForce = Cbi.TimeInForce.Day;

    Is it possible that the arrival of the next tick was earlier than the execution of the entry order, resulting in the entry order being placed again?

    My understanding was that the entry order would be cancelled and resubmitted if it was not already executed, so it should still result in only one entry.

    Regardless of the cause, I think I can prevent this occuring by setting EntriesPerDirection = 1; Right?

    If EntriesPerDirection = 3; in Initialize(), but I change it to 1 in the New Strategy settings when the strategy is added in the Control Center, which takes precedence?

    Sorry about the many questions, but this is trading live and I don't want to make unnecessary changes.

    Cheers
    Tony

    #2
    Hi Tony, since you're placing a market order I would not expect it to expire and thus get resubmitted - the reason was the higher EntriesPerDirection you ran with hitting the race condition on the execution taking longer than the next tick with COBC false, that's my best guess as well without having run it. The UI entered EntriesPerDirection would override your code setting, so that's a possible approach.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks, Bertrand.
      All is clear.
      Cheers
      Tony

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kevinenergy, Yesterday, 12:01 PM
      6 responses
      22 views
      0 likes
      Last Post kevinenergy  
      Started by DawnTreader, 05-08-2024, 05:58 PM
      15 responses
      47 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by ZeroKuhl, Yesterday, 04:31 PM
      7 responses
      40 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by xepher101, Today, 12:19 PM
      1 response
      22 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by jpeep, 08-16-2020, 08:31 AM
      16 responses
      498 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X