Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

bug with unmanaged orders and exit on close

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

  • NinjaTrader_PatrickH
    replied
    Hello yeshe,

    Thank you for your post.

    The code would be the following:
    Code:
    if(execution.Name == "Exit on close")

    Leave a comment:


  • yeshe
    replied
    Hello

    by searching for an answer i ran into this thread.

    (unmanaged approach)
    my question is when exit on close was the reason for executing how to track it in OnExecution(IExecution execution):
    if (execution=ExitOnCLose)???

    tx

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    darckeen,

    This is expected. You have both bars of the same instrument and as such ExitOnClose is only applicable to the primary series of the instrument. Since the secondary series is processed after the primary, you are submitting the order from the secondary which means the ExitOnClose logic was already done and over with at the time you submitted the order. This further means the order goes in after the fact and so as such you will indeed be in a position overnight with this strategy logic.

    Leave a comment:


  • darckeen
    replied
    primary instrument is SPY 5 minute

    Code:
     
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    this.ExitOnClose = true;
    this.Unmanaged = true;
    Add("SPY",PeriodType.Minute,30);
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    DateTime bartime = (DateTime)Times[BarsInProgress][0];
    if (bartime.Hour == 16 && BarsInProgress == 1) SubmitOrder(0,OrderAction.Buy,OrderType.Market,100,0,0,"","");
    }

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    If you submitted to the primary series the end of session handling should've caught it - would you mind sending me your script for testing and looking into here?

    Thanks

    Leave a comment:


  • darckeen
    replied
    Originally posted by NinjaTrader_Bertrand View Post
    darckeen, is this a MultiSeries script and are you submitting orders to the primary series only at this point?
    Yup its a multisereis single instrument strategy, the entry order is submitted to the primary bar series but on the secondary series update.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    darckeen, is this a MultiSeries script and are you submitting orders to the primary series only at this point?

    Leave a comment:


  • darckeen
    started a topic bug with unmanaged orders and exit on close

    bug with unmanaged orders and exit on close

    I've found that if an entry order is palced on the last bar of session when being flat with managed orders disabled and exit on close enabled, the entry order executes on the close of the of the last bar of the session resulting in a possition held over night.

Latest Posts

Collapse

Topics Statistics Last Post
Started by DawnTreader, 05-08-2024, 05:58 PM
7 responses
25 views
0 likes
Last Post NinjaTrader_Gaby  
Started by sgordet, Today, 05:24 AM
0 responses
4 views
0 likes
Last Post sgordet
by sgordet
 
Started by royhagerman, Today, 04:30 AM
0 responses
1 view
0 likes
Last Post royhagerman  
Started by haas88, 03-21-2024, 02:22 AM
18 responses
208 views
0 likes
Last Post haas88
by haas88
 
Started by Board game geek, Today, 02:20 AM
0 responses
8 views
0 likes
Last Post Board game geek  
Working...
X