private void Enter_ATM(OrderAction orderAction, int stopDiff)
{
//ATM Entry
isAtmStrategyCreated = false; // reset atm strategy created check to false
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
string ATMName = Enter_ATM_GetATMName(stopDiff);
Print("Start ATM Order - Name " + ATMName);
AtmStrategyCreate(orderAction, OrderType.Market, 0, 0, TimeInForce.Day, orderId, ATMName, 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;
else
Print("ATM Error: " + atmCallbackErrorCode.ToString());
});
// Check that atm strategy was created before checking other properties
Print("ATMStrategyCreated: " + isAtmStrategyCreated);
if (!isAtmStrategyCreated)
return;
}
In the NinjaScript Output, here is what I am seeing:
Start ATM Order - Name TNT TS SL 15
ATMStrategyCreated: False
ATM Error: NoError
The order is created and I can see the OCO, but the problem I am running into, is that when I try to call GetAtmStrategyMarketPosition(atmStrategyId) an error is returned saying the ATM Strategy ID "...." does not exist
When I run the system in playback it is showing ATMStrategyCreated: True and everything works fine.
I am not sure what may have changed or what the issue may be. Any ideas?
Thank you,
Jeremy

Comment