Inside my OnBarUpdate() I have this:
if (CurrentBar == Bars.Count -2 || CurrentBar == Bars.Count -1) { // -2 as it's zero based plus we operate on a closed bar basis Print(String.Format("Writing JSON to file at Bars.Count: {0} and CurrentBar: {1}... ", CurrentBar, Bars.Count), PrintLevel.INFO); WriteToJSON(Instrument.FullName + "-" + BarsPeriod.Value + "-" + BarsPeriod.BarsPeriodType, netlinerLog); }
This works but intermittently. I had this running for a few days and on some days the JSON log gets updated and on the next day it didn't.
With the strategy set to OBC the OnBarUpdate method should only be called once per day (it's a daily series) and the condition should pass.
When I reload the strategy then the JSON log gets updated properly.
Any idea as to what may be going on?
Thanks!
Comment