Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Problems with strategy on live Ameritrade account
Collapse
X
-
Hi zgdesign, I must make a correction to what I said earlier about modifying your stop loss, the connection guide tells us that an OCO order must be canceled and re-submitted to be modified:
https://ninjatrader.com/ConnectionGu...nnection-Guide- When submitting orders within an OCO group, the orders must be submitted as a pair and after submission, those orders will no longer be modifiable. To make a change to an OCO grouped order it must be cancelled and resubmitted. ATM functionality which would modify submitted stops and targets on TD Ameritrade accounts are therefore not supported.
Comment
-
Hello Chris,
Ok, but as I said in my original post, I'm not trying to modify the OCO order in any way. It's just a simple OCO order with a static stoploss/profit target.
This is the most basic of functions, which I would expect to work.
Also, this doesn't work on the previous version running on Windows 10 either.Last edited by zgdesign; 06-08-2022, 11:04 AM.
Comment
-
Hi Chris,Originally posted by NinjaTrader_ChrisL View PostHi zgdesign, I made a ticket with our development team and still waiting to hear about the order that gets stuck in Initialized state with the TDA connection.
Do you have any updates on this? I'm at a standstill until this is resolved.
Comment
-
Hi zgdesign, I just checked the status. There is a fix planned for the V8R27 update. There will be a notification in the platform when the update is released. Unfortunately, I can not give an exact time frame for when this will be, but It will be addressed in the next update.
Kind regards,
-ChrisL
Comment
-
Hi Chris,Originally posted by NinjaTrader_ChrisL View PostHi zgdesign, I just checked the status. There is a fix planned for the V8R27 update. There will be a notification in the platform when the update is released. Unfortunately, I can not give an exact time frame for when this will be, but It will be addressed in the next update.
Kind regards,
-ChrisL
Do you have any idea when the new release will be out?
I've been patiently waiting, but it's been 3 months now, and I'm still stuck with NT which doesn't work with AMTD.
Comment
-
Hi Chris,Originally posted by NinjaTrader_ChrisL View PostHi zgdesign, It would be for manual orders. For the strategy, please try this method of submitting protective orders:
This is the first time the issue has been reported, so it's possible it showed up in R26. You can try reverting back to R25 by first uninstalling through the Windows Control Panel, then install the previous version from here (look below the current release)
ninjatrader.com/GetStarted
Given that I can't run any strategies with OCO orders until the next release, and there's no timeframe on when that will actually happen, I'm willing to try anything at this point to get my strategies running live.
Can you please elaborate on your reply above? Perhaps some example code of how to place protective orders using OnOrderUpdate() and OnExecutionUpdate()?
Comment
-
Hi Chris,Originally posted by NinjaTrader_ChrisL View PostHi zgdesign, Im sorry for the delay. The example I posted earlier has an example code file at the bottom for download:
https://ninjatrader.com/support/help...and_onexec.htm
So I was able to get the order to submit via OnOrderUpdate and OnExecutionUpdate, however when the order fills it fills with either a stoploss, or a profit target, but not both. It seems like one of the two cancels the other out, because I see the stoploss in TOS, but then it cancels out once the profit target shows up. Is there a way to make it an OCO order, with both a profit target and and a stoploss?
This is the code I'm using:
private void myOrderFunction(){// Submit an entry market order if we currently don't have an entry order open and are past the BarsRequiredToTrade bars amount
if (entryOrder == null && Position.MarketPosition == MarketPosition.Flat && CurrentBar > BarsRequiredToTrade)
{
/* Enter Long. We will assign the resulting Order object to entryOrder1 in OnOrderUpdate() */
EnterLong(1, "MyEntry");
Print("entering LONG");
}
{
}
}
protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
{Print(execution.ToString());}
/* We advise monitoring OnExecution to trigger submission of stop/target orders instead of OnOrderUpdate() since OnExecution() is called after OnOrderUpdate()
which ensures your strategy has received the execution which is used for internal signal tracking. */
if (entryOrder != null && entryOrder == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
// We sum the quantities of each execution making up the entry order
sumFilled += execution.Quantity;
// Submit exit orders for partial fills
if (execution.Order.OrderState == OrderState.PartFilled)
{
stopOrder = ExitLongStopMarket(0, true, execution.Order.Filled, execution.Order.AverageFillPrice - 4 * TickSize, "MyStop", "MyEntry");
targetOrder = ExitLongLimit(0, true, execution.Order.Filled, execution.Order.AverageFillPrice + 8 * TickSize, "MyTarget", "MyEntry");
}
// Update our exit order quantities once orderstate turns to filled and we have seen execution quantities match order quantities
else if (execution.Order.OrderState == OrderState.Filled && sumFilled == execution.Order.Filled)
{
// Stop-Loss order for OrderState.Filled
stopOrder = ExitLongStopMarket(0, true, execution.Order.Filled, execution.Order.AverageFillPrice - 4 * TickSize, "MyStop", "MyEntry");
targetOrder = ExitLongLimit(0, true, execution.Order.Filled, execution.Order.AverageFillPrice + 8 * TickSize, "MyTarget", "MyEntry");
}
// Resets the entryOrder object and the sumFilled counter to null / 0 after the order has been filled
if (execution.Order.OrderState != OrderState.PartFilled && sumFilled == execution.Order.Filled)
{
entryOrder = null;
sumFilled = 0;
}
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
59 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
74 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment