Is there a simple way to know in Newbar() whether the currently processed bar is the final one available?
Currently, I've got a very ugly workaround in place for this purpose. My workaround involves invoking my custom database class, and asking the database directly for the last date. Very messy, and shouldn't be necessary.
Why would one need to know if it's the last bar? For example, to color the chart based on open positions (See attached images as example) or to run some custom reporting or other code that should only run once the simulation is complete, but still doesn't belong in a SystemResults plugin. Even more important could be to make sure a position is properly closed, if for some reason data ceases to exist. This could be a delisted stock for instance.