Monday, February 9, 2009

Relative Volume

Being able to identify whether volume for a given period in the E-Minis futures contract is higher or lower than the average volume for that period is a valuable trading tool. Traditional moving averages do not do a good job here as volume is highly correlated to time of day. Specifics on the usefulness of relative volume have been covered in detail by others; I will limit this post to providing some thinkScript code for ThinkOrSwim that plots relative volume on a volume chart. This code does a lookback over the previous 10 trading days, and provides a line graph of average volume for the current trading session, overlayed on the volume chart.

# JBAKER RelativeVolume in ThinkScript
# Inputs; set period to the chart period
# Default for period is 30 minutes
# Do not include data for AH/premarket; this will skew the RelativeVolume plot
# This study is an overlay on the volume chart; you must show volume for this study to be visible.

declare upper;
declare zerobase;
declare on_volume;
declare real_size;

input period = 30;
Def multi = (390/period); # minutes per trading day

# Relative Volume code

plot VolRelativeAverage = (volume[multi] + volume[2*multi] + volume[3*multi] + volume[4*multi] + volume[5*multi] + volume[6*multi] + volume[7*multi] + volume[8*multi] + volume[9*multi] + volume[10*multi]) / 10;

VolRelativeAverage.SetDefaultColor(Color.YELLOW);

No comments:

Post a Comment