Set the 'Parameter type' to Price, set the price to 99999
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Order rejected
Collapse
X
-
-
Hello OldHatNoobCoder,
This is showing the limit was rejected due to the OCOID. To confirm you are not submitted the replacement order through the account correct?
If so, this is showing that even without submitting the order through the account the same error is occurring, and further shows with live orders your broker isn't rejecting orders that re-use OCOIDs from rejected/cancelled/filled orders and has different behavior than the Sim101 (or how NinjaTrader Brokerage works).Chelsea B.NinjaTrader Customer Service
Comment
-
-
I changed the ordering of GetAtmStrategyStopTargetOrderStatus() and I was able to produce this error:
Comment
-
Hello OldHatNoobCoder,
This occur typically occurs if this method is called before the entry order as filled and the Atm has become active. The warning in orange can be ignored if you are intentionally checking the stop and target status before the entry has filled and the Atm is active.Chelsea B.NinjaTrader Customer Service
Comment
-
Hmm. When I place it later, nothing at all happens.
Code:// If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements if (status.GetLength(0) > 0) { Print("The entry order average fill price is: " + status[0]); Print("The entry order filled amount is: " + status[1]); Print("The entry order order state is: " + status[2]); // If the order state is terminal, reset the order id value if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected") orderId = string.Empty; } } // If the stop order has been rejected, submit a new sell order if (atmStrategyId.Length > 0) { bool stopOrderRejected = false; string[,] stopOrders = GetAtmStrategyStopTargetOrderStatus("STOP1", atmStrategyId); if (stopOrders.Length > 0) { for (int i = 0; i < stopOrders.GetLength(0); i++) { if (stopOrders[i, 2].ToString() == "Rejected") { stopOrderRejected = true; Print ("Stop order rejected mofo "); break; } } } if (stopOrderRejected) { double limitPrice = Close[0] - 10 * TickSize; Order newLimitOrder = myAccount.CreateOrder(myInstrument, OrderAction.Sell, OrderType.Limit, OrderEntry.Automated, TimeInForce.Day, 1, limitPrice, 0, string.Empty, "NewLimitOrder", Core.Globals.MaxDate, null); Account.Submit(new[] { newLimitOrder }); } // If the strategy has terminated reset the strategy id else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat) atmStrategyId = string.Empty;
Comment
-
Also, the rejection messages were from the ATM strategy, and in that instance I was calling it beforeThis occur typically occurs if this method is called before the entry order as filled and the Atm has become active. The warning in orange can be ignored if you are intentionally checking the stop and target status before the entry has filled and the Atm is active.So as far as I know, this doesn't sound like it applies?Code:// If the order state is terminal, reset the order id value
Comment
-
Hello OldHatNoobCoder,
By 'place it later' do you mean you are calling the method later in time, or do you mean you are calling the method lower in the code? (An a new bar update would be later in time. lower in the code would be at the same time)
Before calling this are you checking that the GetAtmStrategyEntryOrderStatus() is returning as Filled?Chelsea B.NinjaTrader Customer Service
Comment
-
I meant lower in the code.By 'place it later' do you mean you are calling the method later in time, or do you mean you are calling the method lower in the code?
Yes, just didn't paste that:
Code:string[] status = GetAtmStrategyEntryOrderStatus(orderId); // If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements[QUOTE][/QUOTE]
Comment
-
Thank you for talking in consideration the suggestion is very appreciated. I wander, has Ninjatrader then provided a Logic? I cannot find it anywhere.Originally posted by NinjaTrader_ChelseaB View PostHello Bruce,
You are referring to adding rejection handling logic to the SampleATMStrategy included with NinjaTrader?
Thank you for the suggestion. We will take this into consideration.
I also have these some questions:
1)
I tried to the code presented just here two paragraphs above on 05-11-2023, 08:54 AM and I tried different coding.
Basically I am never able to get any information with GetAtmStrategyStopTargetOrderStatus() no matter what I do. Whether the order gets rejected or the Stop and Target are active.
I always get
'GetAtmStrategyMarketPosition' method error: ATM strategy ID 'f7772ba8541d43eaa993147ded0ec9df' does not exist
'GetAtmStrategyStopTargetOrderStatus' method error: ATM strategy ID 'f7772ba8541d43eaa993147ded0ec9df' does not exist or is already in a terminated state
I am unable to get any stop/target information and I did all possible PrintOuts. I see OldHatNoobCoder tried.
I followed your recommendation above and I suspect that the problem is that I should provide the stop order ID instead of the atmStrategyId received by AtmStrategyCreate. Is that the reason? and if so, how do I get the order ID of the stop and target to be able to query them?
In the documentation for GetAtmStrategyStopTargetOrderStatus() I don't see an example.
2) If I get the ATM stop rejected in very fast market the ATM dies leaving me with exposed open position. Maybe the easiest solution to be compatible with NinjaTrader and Rithmic is to use CreateOrder. Can you indicate me a forum's thread that shows a way to track multiple different orders with a strategy that uses CreateOrder()?
3) Can you also indicate where I can find a way to monitor the ATM and close open position that are left exposed without bracket?
Best,
GioLast edited by giogio1; 12-09-2024, 06:16 AM.
Comment
-
Hello Gio,
"I wander, has Ninjatrader then provided a Logic? I cannot find it anywhere."
Unfortunately, no, the SampleAtmStrategy example does not have logic to handle an order rejection.
"Basically I am never able to get any information with GetAtmStrategyStopTargetOrderStatus() no matter what I do. Whether the order gets rejected or the Stop and Target are active."
Please provide the print output showing the value of the isAtmStrategyCreated bool and the value of GetAtmStrategyEntryOrderStatus() (which requires supplying the entry order id).
"If I get the ATM stop rejected in very fast market the ATM dies leaving me with exposed open position. Maybe the easiest solution to be compatible with NinjaTrader and Rithmic is to use CreateOrder. Can you indicate me a forum's thread that shows a way to track multiple different orders with a strategy that uses CreateOrder()?"
Below is a link to examples, ProfitCaseStopTrailIndicatorExample and ProfitChaseStopTrailAddonExample that use Account.CreateOrder() and Account.Submit().
"Can you also indicate where I can find a way to monitor the ATM and close open position that are left exposed without bracket"
If an order submitted by an Atm is rejected, this would cause the Account.OrderUpdate event to update with the rejected order.
Chelsea B.NinjaTrader Customer Service
Comment
-
Everything I have tested says this statement is untrue. The example link that ChelseaB has shown below this statement is not for an ATM template submitted order. It shows a stop and profit target added to an order. Order update does not seem to trigger from an Atm order change event, such as Stop rejected. Further, If the ATM is fully in place and you do a AtmStrategyStopTargetChange() to move the stop and the market moves too fast and you get the stop rejected. GetAtmStrategyStopTargetOrderStatus() will not read the correct value of the status. At least not from PLayback101 or Sim101. I have not found a way to directly read or detect a Stop Rejected from an atm submitted stop order. If anyone has been able to figure this one out Please share. ThanksOriginally posted by NinjaTrader_ChelseaB View PostHello Gio,
If an order submitted by an Atm is rejected, this would cause the Account.OrderUpdate event to update with the rejected order.
https://developer.ninjatrader.com/do...op/orderupdate
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
547 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
323 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
99 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
543 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
545 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment