Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Reattaching to Orders After a Crash
Collapse
X
-
Reattaching to Orders After a Crash
I use managed orders in my strategy with SetProfitTarget(). Let's say my strategy has taken 1 position. I can easily record this to disk using a C# file I/O operation. Then say my computer freezes and I have to restart it. Then I restart NinjaTrader and the strategy. I know from what was recorded on disk that a position was taken. Can I re-attach the IOrder variable I was using in the strategy to the outstanding trade? This would give me a way to pickup where I left off before the crash.Tags: None
-
Hello,
Thanks for your patience.
You will not be able to reattach the IOrder object to order since the IOrder.OrderId and IOrder.Token properties do not stay constant and can change throughout the life of the order objects.
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
-
Hello reynoldsn,
Thanks for the reply.
The SetProfitTarget() method in this moment wouldn't attach to an order unless that order is placed through the strategy.
NinjaScript does not have a way of reattaching to this order so a profit target or stop loss could not be placed.
You could however place them manually a profit target as an OCO order, which what NinjaTrader does for ATM's, that would protect your current position. However, you would not be able to do this through NinjaScript.
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
-
That depends on the settings that you are using. you can setup NinjaTrader to recalculate the position based on history, and reissue the necessary orders, based on such.Originally posted by reynoldsn View PostThen say after the crash, I open the same chart I had before and run a different strategy that does nothing but call SetProfitTarget(), the intention being to set the profit target of the trade that is on before the crash - will that work?
Comment
-
To review, the strategy places an order and uses SetProfitTarget(). Before target is reached, the strategy is suddenly closed. Will the target still be in place?The SetProfitTarget() method in this moment wouldn't attach to an order unless that order is placed through the strategy.
Comment
-
Hello,
Thanks for the reply.
This depends on who your connected to and where orders reside. http://ninjatrader.com/support/forum...ead.php?t=5349
Once the order fills and places the profit target and the profit target is accepted, working and this order resides at the brokerage then yes the strategy closing or crashing will not affect that order.
However, this is all based on the order residing at the brokerage and being in a working state before the strategy is closed suddenly. If you have an order that has a profit target set for it but this order has not filled, this profit target will not be submitted if the strategy is not actively working.
Also if this does occur we highly recommend that you contact the orders desk to manage this strategy manually and not rely on the strategy submitting the order successful before a crash.
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
-
I am currently using AMP.
If I may quote:
After an order is placed and a target set, is there a way to get an indication in the strategy that the target order was completed?However, this is all based on the order residing at the brokerage and being in a working state before the strategy is closed suddenly. If you have an order that has a profit target set for it but this order has not filled, this profit target will not be submitted if the strategy is not actively working.
Just to clarify the big picture: I want monitoring and alerts in place. I want some way to know if the target order on my long/short entry was placed successfully and is still there even if my strategy crashes. If so, then I need to be able to query that information and verify it when I reconnect the strategy.Last edited by reynoldsn; 07-09-2015, 07:23 PM.
Comment
-
Hello,
Thanks for the reply.
Yes, you can track the order by setting it to an IOrder object within the OnExecution() method and then determining it's state by using the OrderState values.After an order is placed and a target set, is there a way to get an indication in the strategy that the target order was completed?
Here is a link to the IOrder documentation from the help guide. http://ninjatrader.com/support/helpG...nt7/iorder.htm
Here is a link to the OnExecution() method documentation from the help guide.http://ninjatrader.com/support/helpG...nexecution.htm
This would impossible to tell until the order updates and you receive an update from the brokerage. Again the IOrder number would not match so this order could be a different order depending on how many positions you have set before hand....and is still there even if my strategy crashes.
Also, if your strategy crashes and you are in a position it is highly recommended you contact the orders desk to handle this order manually.
Note, you will not be able to verify with a 100% accuracy the order that updates is the same you placed before the crash.
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
-
Hello,
Thanks for the reply.
If NinjaTrader crashes, since it is a Windows based platform, it should produce an error message from windows.
As far as the strategy suddenly stopping you should be able to put a notification on the onTermination method of the strategy. When the strategy shuts down it will perform the onTermination method. Here is a link to the help guide documentation for the
Also we do not recommend that you let a strategy run without actively monitoring it as any number of unpredictable events can occur (such as power lose) that can not be managed by code within a strategy.
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
-
Hello reynoldsn,
Thanks for posting today.
You can check and attempt to sync the account position to your strategy position.
Here is a link to our help guide that describes syncing account positions. http://ninjatrader.com/support/helpG..._positions.htm
Here is a link to the our help guide that describes strategy position vs account position. http://ninjatrader.com/support/helpG..._account_p.htm
Please let us know if we may be of further assistance for anything NinjaTrader.Alex G.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
548 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
549 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment