Here is a bit of a twist on my earlier Up/Down Volume Ratio study. Rather than plot the ratio of an underlying equity or future contract, this study averages the volume of the /ES, /YM, /NQ, and /TF and performs the same calculations. In essence, I’m trying to see if more of the volume is going into the bars that close down or to those that close up. You can see from the plot that very high ratios often precede tops and very low ratios often precede bottoms. The indicator can also produce nice divergences as well. (NOTE: This one is a resource hog! You may not want to run this on a “challenged” machine)
# TS_FourVolume
# (c) 2009 http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 13 May 2009
declare lower;
input VolumePeriod = 10;
input OscillatorLength = 10;
input priceChangeWeighted = NO;
input overbought = 80.0;
input oversold = 20.0;
input mode = {default UP_DOWN_VOL_RATIO, OSCILLATOR};
def price1 = close("/ES");
def price2 = close("/NQ");
def price3 = close("/YM");
def price4 = close("/TF");
def volume1 = volume("/ES");
def volume2 = volume("/NQ");
def volume3 = volume("/YM");
def volume4 = volume("/TF");
def avePrice = (price1+price2+price3+price4)/4.0;
def delta = absValue(avePrice-avePrice[1]);
def aveVolume = (volume1+volume2+volume3+volume4)/4.0;
def multiplier = if(priceChangeWeighted, delta,1);
plot maxLine = 80.0;
plot minLine = 20.0;
maxLine.setDefaultColor(color.BLUE);
minLine.setDefaultColor(color.BLUE);
plot midLine = 50.0;
midLine.setDefaultColor(color.WHITE);
def up = if(avePrice>avePrice[1], aveVolume*multiplier, 0);
def down = if(avePrice<avePrice[1], aveVolume*multiplier, 0);
def upvol = sum(up, VolumePeriod);
def downvol = sum(down, VolumePeriod);
def UPDVR= ((upvol/(downvol+upvol)));
def highestVR = Highest(UPDVR, OscillatorLength);
def lowestVR = Lowest(UPDVR, OscillatorLength);
plot FourVolume;
switch (mode) {
case UP_DOWN_VOL_RATIO:
FourVolume = UPDVR*100;
case OSCILLATOR:
FourVolume = (UPDVR - lowestVR) / (highestVR - lowestVR)*100;
}
FourVolume.DefineColor("OverBought", Color.DOWNTICK);
FourVolume.DefineColor("Normal", color.cyan);
FourVolume.DefineColor("OverSold", Color.UPTICK);
FourVolume.AssignValueColor(if FourVolume < oversold then FourVolume.color("OverSold")
else if FourVolume > overbought then FourVolume.color("OverBought")
else FourVolume.color("Normal"));





Whoa! Didn’t know referencing another security is so easy. thanks
Eric,
I had this odd idea to write another piece of intraday volume code that would look for volume anomalies by looking for irregular volume by given times. For example, what I mean by this is to take an average of the volumes of the previous 19 days (or whatever is accessible) for the given time interval ranges (e.g. on a 5 min, between 9:30 and 9:35, 9:36 and 9:40, etc.) and then see how the current day’s volume compares to it, as a guage of market participation. Do you have any ideas on how to do this?
Bill
Bill,
At first glance I think we could accomplish this. That said, I’d be lying if I told you I hadn’t thought that on a few occasions in the past only to dive down a never ending rabbit hole. Because thinkScript lacks a true variable storage mechanism, it makes this kind of study tricky to code. Let me think about it….shoot me an email and we can discuss.
Eric
Thank You!… This seems to give VERY reliable signals on /ES for 5 and 15 min charts… Very nice indicator.
Wow. I hadn’t played with many of the volume-ish indicators, but must admit this one looks to be a keeper. Looks to be rather timely and is a nice corollary to my style of trading. I’ll watch it for a few days before incorporating it onto my charts, but I’m pretty sure this will be a keeper along with my IFT-RSI as my lower-level indicators.[1]
[1] Even though I am getting more and more comfortable trading without them!
Too bad this one doesn’t work with Tick charts — watching it this morning, goofy as the market is, definately looks promising!