I'm using Volume Bars and in order to know their "Duration", ie the time the bar takes from open to close, I developed this code snippet:
TimeSpan time1 = Time[0] - new DateTime(1970,1,1,0,0,0);
TimeSpan time2 = Time[2] - new DateTime(1970,1,1,0,0,0);
int diff=(int)time1.TotalSeconds-(int)time2.TotalSeconds;
if(diff > X)
{
Duration = true;
}
else
{
Duration = false;
}
This works well when integrated into my custom strategy but now I'd like to make a standalone indicator out if it that displays the "Duration" in minutes/seconds in the main chart window (panel 1). I'd very much appreciate it if someone could show me how it's done as I'm struggling with the process.
Thanks a lot.

Comment