[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Intraday volume as compared with avg of equiv time periods



PureBytes Links

Trading Reference Links

I had asked for an indicator comparing intraday volume with an average of
the volume for the exact same time periods in prior days.
I found one on Tradestationworld created by Stan@xxxxxxxxxxx with a name of
"SD VolSum & Avg"

Here is the info I abstracted from Tradestationworld to explain the
indicator as well as show the code for anyone else interested.  You can cut
and paste to create your own indicator.

Regards,

Barry Silberman


============================================================================
 {Created by Stan@xxxxxxxxxxx & located on Tradestationworld.com with
Indicator Name: "SD VolSum & Avg"

Study Type: Indicator
Time Frame: Time-based Intraday
Date Posted: 2/6/2003

 Description: This indicator plots the cumulative intraday volume through
the  time of each bar (VolSum) and the average cumulative intraday volume
through  the same time of day (VolSumAvg). This allows the user to compare
the day's  volume up to the current time with the average volume of the last
N days  through the same time of day. An input allows the user to set the
number of  days of data to average into the VolSumAvg.

 Inputs:
DaysToAvg Default = 3  This is the number of days of intraday data, each
through the same time of  day as the current bar, which will be included in
the average.

Plot Descriptions:
 The histogram (Plot1, VolSum) is the cumulative volume for the day through
that bar. The line (Plot2, VolSumAvg) is the average of the last DaysToAvg
days volume through the same time on each of those days.

 Notes:
MaxBarsBack should be left on Auto-detect and will equal DaysToAvg x the
number of bars per day + 1. Plot1, VolSum, will begin plotting following
MaxBarsBack + 1 bars; Plot2, VolSumAvg, will not begin plotting until the
day that is 2 x DaysToAvg + 1. Therefore, a very long DaysToAvg will require
significant data before calculating and plotting the VolSumAvg.

This indicator was written using Time references to establish the VolSumAvg.
The indicator will not be accurate on any symbol that has intraday periods
with no trades, and on those few days a year when exchanges close early and
on the days immediately following.

 ". (he) conceived of this to be used on longer intraday intervals than 6
minutes, probably not less than, say, 15 minute intervals.(he) just didn't
 think the comparisons would mean as much on a micro level, when a single
trade, or lack of trading, could skew the numbers. Also, I often look at the
day in 'segments', that is thirds or sixths or tenths and set the bar
interval accordingly. ... In these cases the indicator gives a pretty good
picture of how the day is shaping up compared to recent similar time frames.
..."  "...a different flaw in the indicator: if the bar interval leaves a
last bar of the day with a smaller number of minutes, then the bars per day
calculation would not be correct. For example, on a 60-minute chart of a 390
minute day, the last bar only covers 30 minutes. Although there are 7 bars
in the day, my calculation would result in 6.5 bars per day.   This version
adjusts for that.}

Input: DaysToAvg(3);
Vars: LenOfDay(0), BPD(0), BarsPerDay(0), VolSumToAvg(0), VolSum(0),
VolSumAvg(0);

 If BarType = 1 then begin
           LenOfDay = TimeToMinutes(Sess1EndTime) -
TimeToMinutes(Sess1StartTime);
           BPD = LenOfDay/BarInterval;

           If FracPortion(BPD) = 0 then
               BarsPerDay = BPD
          else
              BarsPerDay = BPD + 1 - FracPortion(BPD);

   VolSumToAvg = 0;

   If Date <> Date[1] then
       VolSum = Ticks
   else
       VolSum = VolSum + Ticks;

   For Value1 = 1 to DaysToAvg begin
        VolSumToAvg = VolSumToAvg +  VolSum[BarsPerDay*Value1];
   end;

   VolSumAvg = VolSumToAvg / DaysToAvg;


   Plot1(VolSum, "VolSum");

   If BarNumber > BarsperDay * DaysToAvg then
   Plot2(VolSumAvg, "VolSumAvg");
 end;