Thank you for the reply.
If you are using NinjaScript properties in an out of sync method like a buttons event handler, you may need to use TriggerCustomEvent to sync the NinjaScript inherited values to avoid using DateTime.Now. I would also not suggest using DateTime.Now in the platform as this has no relation to the bars times.
https://ninjatrader.com/support/help...ghtsub=trigger
you would likely need to change the method you use to have an object overload like shown in the help guide. Once you do that, you can call trigger custom event like the following:
private void btnDraw_Click(object sender, EventArgs e) { TriggerCustomEvent(MyCustomHandler, null); } private void MyCustomHandler(object state) { Print("Time[0] should now work: " + Time[0].ToString()); }
I look forward to being of further assistance.
Leave a comment: