I'm trying to work on an indicator that calculates the average time it takes to form a non time bar ( range, volume etc.). The average is based on the last 10 candles and ideally, would be displayed on the bottom left portion of the screen, similar to the "bar timer" indicator.
I searched the forum and got this code to start with:
private Stopwatch stopWatch = new Stopwatch();
protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
{
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Print(String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds / 10));
stopWatch.Reset();
stopWatch.Start();
}
Any help would be greatly appreciated.

Comment