Inside OnBarUpdate(), I want to avoid executing certain code while the Playback connection loads historical bars as it gets itself to the date/time I choose. Then, after I press the "Play" button I want to begin executing that code -- just like normal real-time trading.
Calculate is set to Calculate.OnBarClose;
When I use the following test, the code inside the brackets executes during load of Playback bars (historical) and when printing bars in "real time":
if ( State == State.Realtime ) // Have also tried if ( State == State.Realtime & CurrentBar == Count - 2 )
{
// Do something - should only execute this code after "Play" button is pressed, not while Playback is loading chart with historical bars
}
How can I keep the code inside the brackets above from executing until "Play" is pressed?
Thank you.
Comment