Tuesday, June 1, 2010

EasyLanguage Relative Volume Indicator

Several years ago, Dr. Brett Steenbarger proposed the idea of "Relative Volume" on Traderfeed. In this case, the core concept was to adjust intraday volume bars for the smile effect, whereby opening and closing volume are greater than the mid-session trade (see Predicting SPY Volume). Only in this way can the trader assess the normalized significance of volume bars irrespective of the time of day.

In the graph below, you can see the importance of tracking volume as a confirming indicator for prospective peaks and valleys in price action. As long as relative volume is building over and above significant historical levels, it's generally safe to assume that either fear or greed are having their way with momentum. Only when that volume subsides can a new equilibrium said to have been established for a potential pause -or- reversion.


That's what I call "stopping power", and while it doesn't always work so cleanly, it should be a strong alert for day traders, especially when used in conjunction with volatility measures. Furthermore, astute observers may discern a cumulative supportive or resistive effect on price by these spikes.

I include relative volume in each day's mid-day chart post and often refer to it. You may get a better feel for the metric by perusing these past Market Rewind posts:
TradeStation EasyLanguage Code

Finally, by popular request, below is my code for relative volume as programmed in Tradestation's EasyLanguage. While experience is a good teacher of what represents significance, an obvious improvement to this example would convert the raw score with a z-score or percentrank. Meanwhile, note both the normalizing and smoothing elements below:

//Relative Volume (c) Market Rewind 2010 inspired by Traderfeed
//Used on SPY 3-min Bars; Requires 20-Days of Data

Variable: NumDay(1), NumBar(0), RelVol(0);

Array: VolArray[200](0);

If Date > Date[1] Then Begin
NumDay = NumDay + 1;
NumBar = 0;
End;

If Time > 0630 AND Time < 1315 Then Begin //Local Time (PST)

If Volume > 0 Then Begin
NumBar = NumBar + 1;
VolArray[NumBar] = VolArray[NumBar] + Volume;
RelVol = Volume / (VolArray[NumBar]/ NumDay);
End;

Plot1(jtHMA(average(RelVol,6),6), "RelVol", Iff( Time > 1310, Black, White)) ; //Local Time

End;

If you don't have the Hull Moving Average function (search jtHMA on the TS forums), the plot line may be changed as follows:

Plot1(average(RelVol,8), "RelVol", Iff( Time > 1310, Black, White)) ; //Local Time

4 comments:

Anonymous said...

This idea is fascinating, but I have a really hard time reading your chart and determining what the relative volume is and relating it to price... busy chart. I hope this does not come as offense as this is a fantastic concept and great that you offer it out to the public!

jgpietsch said...

Hi Anon,

Key:

Heavy White Line = Relative Volume
Thin Grey Line = Russell Volatility Index
Candlesticks = SPY

Ignore everything else for the purpose of this post.

Cheers,
Jeff

Josh said...

Hi Mark,

So if I understand your code correctly, the number of days that a time period's volume is averaged depends on how many bars you have open in your chart in Tradestation? In other words, if I format the symbol and set the days back to be 200 then will, for example, 10:05 am's average volume be the average 10:05 am volume of the past 200 trading days?

Josh

jgpietsch said...

Hi Mark, I don't think you can run intraday data back that far? In any event, it should work as you have suggested, but personally I'm set up with 20-days and 3-min bars. Best, Jeff