Thank you for the reply and testing that.
After further inspection of your code it looks like your print is within the ATM's callback however that is not a NinjaScript event driven callback so that won't relate to the context of your script.
In your AtmStrategyCreate syntax you would need to surround any NinjaScript properties with a TriggerCustomEvent, this callback is not generally used to access NinjaScript properties but is used to set a boolean variable to denote the state of the ATM.
Here is a way you can observe the difference between contexts, this is the same concept as the different context between OnBarUpdate and OnRender overrides.
AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Gtc, orderId, "AtmStrategyTemplate", 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; Print("Time from AtmStrategyCreate: " + Time[0]); TriggerCustomEvent(new Action<Object>((o)=>{ Print("Time from TriggerCustomEvent: " + Time[0]); }), null); });
In this test I was able to see the charts first bar date printed in addition to the current bars time:
Time from AtmStrategyCreate: 10/27/2019 4:00:10 PM
Time from TriggerCustomEvent: 10/29/2019 11:59:50 AM
I look forward to being of further assistance.
Leave a comment: