Is this expected? Is there a way to avoid receiving this error when I run OnEachTick? My suspicion is that a tick occurs and updates the indicator before the order can be initialized in the system.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
'GetAtmStrategyUnrealizedProfitLoss' method error: ATM strategy ID does not exist
Collapse
X
-
'GetAtmStrategyUnrealizedProfitLoss' method error: ATM strategy ID does not exist
I used the SampleATMPnL as a base and made it send a limit order instead of a market. When I run OnEachTick, sometimes I get the error 'GetAtmStrategyUnrealizedProfitLoss' OR 'GetAtmStrategyEntryOrderStatus' method error: ATM strategy ID does not exist.
Is this expected? Is there a way to avoid receiving this error when I run OnEachTick? My suspicion is that a tick occurs and updates the indicator before the order can be initialized in the system.Tags: None
-
Hello Jack22,
These warnings are expected if the methods are being called when there is no order id that exists. This can happen if you are calling the methods before an order or also after it has filled and a number of ticks have elapsed. The ATM's are not necessarily like strategy orders which persist constantly in your strategy, these instead have a lifetime and once they are gone you would get this message if the method is still being called.
Currently there are no ways to suppress this message that I am aware of, I could only suggest using the managed or unmanaged approach to avoid that.
I look forward to being of further assistance.
-
Hello Forum,
I also face an issue with GetAtmStrategyEntryOrderStatus ... I'm using the exact code to create an order based on the system provided template:
isAtmStrategyCreated = false; // reset atm strategy created check to false
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(OrderAction.Sell, OrderType.StopLimit, Low[0]-3*TickSize, Low[0]-2*TickSize, TimeInForce.Day, orderId, atmTemplate, atmStrategyId, (atmCallbackErrorCode, atmCallBackId)
=> {
//check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId){
isAtmStrategyCreated = true;
}
});
if ( isAtmStrategyCreated == true && orderId.Length > 0 ){
status = GetAtmStrategyEntryOrderStatus(orderId);
// Alert("StrategyOrder", Priority.High, "StrategyOrder submitted" + " Chart Period: " + BarsPeriod.Value.ToString() + " " + BarsPeriod.BarsPeriodType.ToString(), NinjaTrader.Core.Globals.InstallDir+...s\Aler t4.wav", 10, Brushes.Black, Brushes.Blue);
Print("OrderId: " + orderId + " Status: " + status[2]);
}
Here's is the NinjaScript Output after the order AtmStrategyCreate() got triggered:
'GetAtmStrategyEntryOrderStatus' method error: Order ID 'bac1e9602fff474b8317ec94daf4ded1' does not exist
The order does actually get submitted and appears in the system, so why does the system report, that the Order ID does not exist?
My Calculate is set to "On bar close" - does a strategy need to be set to "on each tick"???
Comment
-
Hello abctrader,
Getting the status of an external strategy will rely on that strategies state, from just the syntax I really couldn't say if that was correct or not for the situation.
You can try testing the SampleATMStrategy which also uses this method to see if it reports a similar message in that use case, that could help to confirm if this relates to your logic. It is expected to see this warning when the order no longer exists or if you call this before the order is working/filled. You can try using OnEachTick, that will give you more frequent updates in case the OnBarUpdate is happening outside of where the order can be seen.
If your logic is critical for the state of the orders or targets I would suggest to avoid using the ATM methods and just use the managed or unmanaged approach so you can have complete control over the orders and status of the strategy.
I look forward to being of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 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