I'm trying to build an indicator which gathers volume data to compare to the closing bar, but the catch is that I only want to compare volume from the same time of day. Since volume varies throughout the day, I don't want to compare a bar in an after hours session to a regular market session because the comparison is not valid.
i.e. volume at 12 AM should be compared to volume in prior session at 12 AM
I tried to do it like this, but it didn't work. I need to get an array of volumes with 30 or more elements from the same time of day. The main problem seems to be an inability to grab Time[i] for N bars back.
double[] volume = new double[30];
if (CurrentBar > 30)
{
for (int i = 0; i < 30; i++)
{
if (Volume[i] > 0 && Time[i].ToShortTimeString() == Time[0].ToShortTimeString())
{
volume[i] = Volume[i];
}
}
}
Comment