Currently I have the same strategy running both on a Live account and a Sim101 account. The strategy places a TP and SL when a particular order is filled, but sometimes fails to do this on the Live account while it executes perfectly on the Sim101 account. Is there any way to resolve this problem?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Live Strategy Does Not Execute The Same As Sim101
Collapse
X
-
Live Strategy Does Not Execute The Same As Sim101
Good morning Ninjatrader staff,
Currently I have the same strategy running both on a Live account and a Sim101 account. The strategy places a TP and SL when a particular order is filled, but sometimes fails to do this on the Live account while it executes perfectly on the Sim101 account. Is there any way to resolve this problem?Tags: None
-
This is the part of the code that fails to trigger.
if (S1 != null && S1 == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled)
{
TP = ExitShortMIT(0, true, 1, KyoriBands(TwentyFive, Fifty, SeventyFive).Low2[0], "TP", "S1");
SL = ExitShortStopMarket(0, true, 1, Close[1] + 1 * TickSize, "SL", "S1");
}
}
-
Hi GLFX005, thanks for your question.
From the code sample it looks like you are not checking for partially filled orders, which can happen on live accounts. You can also better simulate partially filled orders on the Sim101 account by enabling "Enforce Partial Fills" under Tools>Options. We have an example here that uses OnOrderUpdate and OnExecutionUpdate to submit protective orders and it even handles partially filled orders. Please replicate this in your code and let me know if you are still seeing this issue.
Kind regards,
-ChrisL
Comment
-
Hello Chris,
I don't see how this could cause any issues since I am using only 1 contract to trade with, meaning that partial fills can't occur. The first trade happening after every restart of the strategy always comes back in the Filled order state but fails to trigger the code I have provided above in blue. A possible cause could be that I am using the "if Historical = return;" logic or that there's an issue with S1 remaining null even if the order has been Accepted and Filled. The strange thing is that it only happens Live and never on Sim101, so maybe it's a broker issue? I am connected to Dorman through Ninjatrader Brokerage.
Comment
-
Hi GLFX005, thank you for clarifying.
There might be an error message related to the stop order. Please turn on TraceOrders in State.SetDefaults "TraceOrders = true;" and this will print out information about all orders made by the strategy. If the code is actually calling your stop loss order and its not being submitted there should be an error listed in the trace orders.
I look forward to hearing from you.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
111 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
59 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
38 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
41 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
78 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment