Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
bug with unmanaged orders and exit on close
Collapse
X
-
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.Tags: None
-
Originally posted by NinjaTrader_Bertrand View Postdarckeen, is this a MultiSeries script and are you submitting orders to the primary series only at this point?
Comment
-
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,"",""); }
Comment
-
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.Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
26 views
0 likes
|
Last Post
by wzgy0920
Today, 10:43 PM
|
||
Started by wzgy0920, 02-22-2024, 01:11 AM
|
5 responses
32 views
0 likes
|
Last Post
by wzgy0920
Today, 10:33 PM
|
||
Started by wzgy0920, Yesterday, 09:53 PM
|
2 responses
49 views
0 likes
|
Last Post
by wzgy0920
Today, 10:29 PM
|
||
Started by Kensonprib, 04-28-2021, 10:11 AM
|
5 responses
192 views
0 likes
|
Last Post
by Hasadafa
Today, 10:19 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
11 responses
3,234 views
0 likes
|
Last Post Today, 08:07 PM |
Comment