This indicator attempts to capture the ratio of rising price volume to falling price volume. The display is an average of up bar volume divided by down bar volume. The mid line is the 50/50 ratio. A divergence between price and the indicator can signal non-confirmation of the trend. (Note: Initial positing of the code had some lines missing)
# UPDOWNVOLUMERATIO # http://www.thinkscripter.com # thinkscripter@gmail.com # Last Update 19 Jan 2009 declare lower; input period = 10; input smoothingPeriod = 3; input priceChangeWeighted = NO; def delta = absValue(close-close[1]); def multiplier = if(priceChangeWeighted, delta,1); plot maxLine = 80.0; plot minLine = 20.0; maxLine.setDefaultColor(color.BLUE); maxLine.setLineWeight(2); minLine.setDefaultColor(color.BLUE); minLine.setLineWeight(2); plot midLine = 50.0; midLine.setDefaultColor(color.WHITE); midLine.setLineWeight(2); DEF up = if(close > close[1], volume*multiplier, 0); DEF down = if(close < close[1], volume*multiplier, 0); DEF upvol = sum(up, period); DEF downvol = sum(down, period); DEF ratio = (100.0*(upvol/(downvol+upvol))); DEF UPDVR = HullMovingAvg(ratio,smoothingPeriod); DEF lineColor = if(UPDVR >= 80.0, 6, if(UPDVR < 20.0,5,1)); DEF plotData = UPDVR; plot VolumeRatio = UPDVR; VolumeRatio.AssignValueColor(getColor(linecolor)); VolumeRatio.setLineWeight(3); VolumeRatio.setPaintingStrategy(paintingStrategy.HISTOGRAM); plot VolumeRatioLine = UPDVR; VolumeRatioLine.AssignValueColor(getColor(if(linecolor != 1, linecolor, 9))); VolumeRatioLine.setLineWeight(2);






I´m trying to understand this indicator. “is an average of up bar volume divided by down bar volume”. an average of what? how many bars?
thanx
If a bar is green its volume is added to a running sum of “Up Volume” and vice versa. The input parameter “period” is the number of bars the sum is carrying. The ratio is then just the Up/Down for that period.
Eric
hi, great job, i’m trying to copy the indicator to TOS ut i get some eror in the code, any advise.
thanks.
Make sure you are using the copy/paste icons that appear in the upper left of the code window. Do not try and manually select the code and copy it as this will not work.
-Eric
thank’s eric for your quick replay , done it the same way you suggest but still don’t work.
Thanks Eric, this is the best forgot about divergence study of the lot….dont know why it took me so long to re-look at it…my question is, is there a way you could plot a dot or somthing on the uper chart or on study to show divergence….will pay a fee for this…. I know nothing about code…..so nobody try and tell me how to do it
thanks
The J-Train