Error on calling 'OnBarUpdate' method on bar X Input string was not in a correct format
I don't know the exact bar number -not important- but it had been working before.
I tried it times to re-enable, and the same error kept coming up. I couldn't imagine what had changed in the code. But...
Seemed like the major thing taking a string parameter is my Log function, which is called plenty from OnBarUpdate() :
private void Log(string message, [CallerMemberName] string memberName = "") { if (DisableLogging || lastLogMsg == message) return; // Set this scripts Print() calls to the second output tab? if (UseOutput2) PrintTo = PrintTo.OutputTab2; else PrintTo = PrintTo.OutputTab1; string id = StrategyName + " " + UniqueID; DateTime date = (State == State.Historical) ? Time[0] : DateTime.Now; string dateStr = (State == State.Historical) ? date.ToString() : date.ToString("HH:mm:ss"); if (lastCaller != memberName) { Print($"\n{id} - {chartInstrument} - [{memberName}] - {dateStr} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); Print(message); } else if (lastLogMsg != message) { if (lastLogTime != dateStr) // Output just time if diff time but not new caller Print(message + $" ( {dateStr} )"); else Print(message); } lastLogMsg = message; lastCaller = memberName; lastLogTime = dateStr; }
So I commented out the middle part, like this:
/* if (lastCaller != memberName) { Print($"\n{id} - {chartInstrument} - [{memberName}] - {dateStr} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); Print(message); } else if (lastLogMsg != message) { if (lastLogTime != dateStr) // Output just time if diff time but not new caller Print(message + $" ( {dateStr} )"); else Print(message); } */
Comment