Bryan
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Why is my stoploss getting canceled here?
Collapse
X
-
Hey, I got it to happen again. I think I figured it out. What's happening is that my script is erroneously calling SetStopLoss() a second time using the same stop price. The second time it's called is when you get the "Expired" error and the stop is removed from the chart.
Here is the output when it happened this time (using V7.0 RC1):
10/20/2010 3:54:29 PM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=701.2 Currency=0 Simulated=False
10/20/2010 3:54:29 PM Amended stop order: Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=Accepted Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Strategy=' ptt Strategy Builder' Type=Stop Tif=Day Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='12/1/2099 12:00:00 AM'
[a tick happens here....below is when OnBarUpdate is called for this next tick]
Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=PendingChange Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Type=Stop Tif=Day OverFill=False Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='1/1/0001 12:00:00 AM'
Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=Accepted Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Type=Stop Tif=Day OverFill=False Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='1/1/0001 12:00:00 AM'
10/20/2010 3:54:29 PM Cancelled expired order: BarsInProgress=0: Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=Accepted Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Strategy=' ptt Strategy Builder' Type=Stop Tif=Day Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='12/1/2099 12:00:00 AM'
Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=PendingCancel Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Type=Stop Tif=Day OverFill=False Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='1/1/0001 12:00:00 AM'
Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=Cancelled Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Type=Stop Tif=Day OverFill=False Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='1/1/0001 12:00:00 AM'
Order='bea98471c5c64f8cb4d287cc3c0ed4e8/Replay101' Name='Profit target' State=PendingCancel Instrument='TF 12-10' Action=BuyToCover Limit price=696.7 Stop price=0 Quantity=1 Type=Limit Tif=Day OverFill=False Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='bea98471c5c64f8cb4d287cc3c0ed4e8' Gtd='1/1/0001 12:00:00 AM'
Order='bea98471c5c64f8cb4d287cc3c0ed4e8/Replay101' Name='Profit target' State=Cancelled Instrument='TF 12-10' Action=BuyToCover Limit price=696.7 Stop price=0 Quantity=1 Type=Limit Tif=Day OverFill=False Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='bea98471c5c64f8cb4d287cc3c0ed4e8' Gtd='1/1/0001 12:00:00 AM'
Comment
-
I was wrong Josh, sorry. It's not calling the SetStopLoss() method twice for the same price. I was confused on the difference between the TraceOrders output:
10/20/2010 3:54:29 PM Amended stop order: Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=Accepted Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Strategy=' ptt Strategy Builder' Type=Stop Tif=Day Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='12/1/2099 12:00:00 AM'
and the OnOrderUpdate() output:
Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=Accepted Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Type=Stop Tif=Day OverFill=False Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='1/1/0001 12:00:00 AM'
I think we still have a problem, and I think it's in the internal Ninja code somewhere. Can you tell me where in your code would trigger the TraceOrders to output the line:
10/20/2010 3:54:29 PM Cancelled expired order: BarsInProgress=0: Order='58d6314b8a294a38a0d651e2c755cb81/Replay101' Name='Stop loss' State=Accepted Instrument='TF 12-10' Action=BuyToCover Limit price=0 Stop price=701.2 Quantity=1 Strategy=' ptt Strategy Builder' Type=Stop Tif=Day Oco='e4cc61fe6fbb42998448ea2c26d4fdb1-779' Filled=0 Fill price=0 Token='58d6314b8a294a38a0d651e2c755cb81' Gtd='12/1/2099 12:00:00 AM'
Comment
-
An expired order is any order that is not kept alive. Unfortunately there are no real hints I can provide you as we would have no idea what your code actually looks like. What I suggest is using Print() liberally along with TraceOrder to fully understand what is happening along each step of the way and also removing all unnecessary parts of your code and try to isolate out the behavior by stripping it down to bare bones.Josh P.NinjaTrader Customer Service
Comment
-
Hi, I had a problem today with a partial cancellation of my stop loss order. I was trading 30 NQ 12/10 contracts long. I hit the stop loss and 10 contracts were sold, but the stop loss for the other 20 contracts were cancelled. Is this an NT problem or a broker problem? This is the first time this has ever happened. Also, this is the first time I hit the stop loss trading more than 10 contracts.Originally posted by NinjaTrader_Josh View PostAn expired order is any order that is not kept alive. Unfortunately there are no real hints I can provide you as we would have no idea what your code actually looks like. What I suggest is using Print() liberally along with TraceOrder to fully understand what is happening along each step of the way and also removing all unnecessary parts of your code and try to isolate out the behavior by stripping it down to bare bones.
Alan KlineLast edited by klineal; 11-01-2010, 10:48 PM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
633 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
364 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
567 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment