Wednesday, April 15, 2009

Volume Buzz TS Style

I created two TS indicators to find stocks with unusually high volume.

The first volume indicator measures the current cumulative volume of the day and compares it with the average cumulative volume.

Here is a screenshot of a list of stocks with their current/avg cumulative ratio, with a chart showing the data for DLR.

As you can see, early on DLR had 3 times its normal volume early on. The bars are colored (if ratio > exceeds a limit) red if the stock is down for the day and green if it is up.

As you can see DLR had tremendous volume today, and noticing this could have led to a great trading opportunity. It resisted new lows and its ability to take out the vwap with an increase in volume midday was the key.

One thing this indicator is lacking is that it does not pick up random spikes in volume during midday or end of day. For this I modified the code to calculate the sum of the volume for the last X bars. This way I can see if the last X bars had significantly more volume than during average trading days.

Below is a display of stocks with this value (end of day results) and an intraday chart of the GOOG volume ratio.


As you can see, the midday spike in volume for GOOG does not look like much when you view volume alone. However, with this ratio you can see how big of an increase it is. Later in the day huge volume came in and bought GOOG into the close.

Here is the code for these indicators.

Cumulative Ratio
Input: DaysToAvg(10), AlertRatio(1.2);
Vars: LenOfDay(0), BPD(0), BarsPerDay(0), VolSumToAvg(0), VolSum(0), VolSumAvg(0), VolSumPct(0), LastClose(0);

If BarType = 1 then begin

LenOfDay = TimeToMinutes(SessionEndTime(0,1)) - TimeToMinutes(SessionStartTime(0,1));
BPD = AbsValue(LenOfDay)/BarInterval;
If FracPortion(BPD) = 0 then
BarsPerDay = BPD
else
BarsPerDay = BPD + 1 - FracPortion(BPD);

VolSumToAvg = 0;

If Date <> Date[1] then begin
VolSum = Ticks;
LastClose = close[1];
end else
VolSum = VolSum + Ticks;

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

VolSumAvg = VolSumToAvg / DaysToAvg;


If VolSumAvg > 0 then
VolSumPct = VolSum / VolSumAvg;

Plot1(VolSumPct, "Vol buzz");

if VolSumPct >= AlertRatio then
if close > LastClose then
SetPlotColor(1,Green)
else
SetPlotColor(1,Red)
else
SetPlotColor(1,White);

If VolSumPct > AlertRatio then
Alert ( "Intraday Volume exceeds" + Spaces(1) + NumToStr(AlertRatio,0) + Spaces(1) + "percent of average." );
end;

Sum Ratio
Input: DaysToAvg(10), LengthOfVol(5), AlertRatio(1.2);
Vars: LenOfDay(0), BPD(0), BarsPerDay(0), VolSumToAvg(0), VolSum(0), VolSumAvg(0), VolSumPct(0), LastClose(0);

If BarType = 1 then begin

LenOfDay = TimeToMinutes(SessionEndTime(0,1)) - TimeToMinutes(SessionStartTime(0,1));
BPD = AbsValue(LenOfDay)/BarInterval;
If FracPortion(BPD) = 0 then
BarsPerDay = BPD
else
BarsPerDay = BPD + 1 - FracPortion(BPD);

VolSumToAvg = 0;

If Date <> Date[1] then
LastClose = close[1];

VolSum = SummationFC(Ticks, LengthOfVol);

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

VolSumAvg = VolSumToAvg / DaysToAvg;

If VolSumAvg > 0 then
VolSumPct = VolSum / VolSumAvg;

Plot1(VolSumPct, "Vol buzz");

if VolSumPct >= AlertRatio then
if close > LastClose then
SetPlotColor(1,Green)
else
SetPlotColor(1,Red)
else
SetPlotColor(1,White);

If VolSumPct > AlertRatio then
Alert ( "Intraday Volume exceeds" + Spaces(1) + NumToStr(AlertRatio,0) + Spaces(1) + "percent of average." );
end;

Here is another demo of the sum ratio on AXP

If you had noticed the spike in volume to 7 times normal, that quick pullback would have been a beautiful entry point.

Update: I forgot to mention to make sure that you include a decent amount of 'additional bars to load'. I use a 5 min chart on radar screen and give it 2000 additional bars.