Get Updates:
Email
Twitter
RSS

One of our members requested an implementation of Sylvain Vervoort’s Short-Term Volume and Price Oscillator as described in the November 2007 issue of Stocks and Commodities magazine. In essence, when the price is trending up and volume is increasing, volume is added into the oscillator calculation. Conversely, when price is trending down and volume is increasing, volume will be subtracted from the oscillator. During consolidation phases when price and volume diverge, volume is not used to calculate the oscillator. A buy is indicated when the oscillator is below the green line but greater than yesterday’s value. A sell is indicated when the oscillator is above the red line but less than yesterday’s value. Also pictured are the Multi-Stops, Volume Profile, and Value Chart.

Short Term Volume and Price Oscillator

Short Term Volume and Price Oscillator

# TS_ShortTermVolumeAndPriceOscillator
# (c) 2009 http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 20 SEP 2009

declare lower;

input period = 8;
input cutoff = 1.0;

input devH = 1.5; #Standard Deviation High
input devL = 1.3; #Standard Deviation Low
input stdevper = 100; #Standard Deviation Period

rec haopen = compoundValue(1, ((open[1] + high[1] + low[1] + close[1]) / 4 + haopen[1]) / 2, hl2);
def haclose = ((open + high + low + close) / 4 + haopen + Max(high, haopen) + Min(low, haopen)) / 4;

def hac = 3 * ExpAverage(haclose, period / 1.6)
- 3 * ExpAverage(ExpAverage(haclose, period / 1.6), period / 1.6)
+ ExpAverage(ExpAverage(ExpAverage(haclose, period / 1.6), period / 1.6), period / 1.6);

def vave = Average(volume, period * 5)[1];
def vmax = vave * 2;
def vc = if(volume < vmax, volume, vmax);

def vtrendi = inertia(volume,period);
def vtrend =vtrendi-vtrendi[1];

def vtr = 3 * ExpAverage(vtrend, period)
- 3 * ExpAverage(ExpAverage(vtrend, period), period)
+ ExpAverage(ExpAverage(ExpAverage(vtrend, period), period), period);

def calc1 = If haC > (haC[1]*(1+cutoff/1000)) and (vtr >=
vtr[1] and vtr[1]>vtr[2]) then vc else If haC < (haC[1]*(1-cutoff/1000)) and (vtr >=
vtr[1] and vtr[1]>vtr[2]) then -vc else 0;
def SVAPOBase = Sum(calc1,period)/(vave+1);

plot SVAPO = 3 * ExpAverage(SVAPOBase, period)
- 3 * ExpAverage(ExpAverage(SVAPOBase, period), period)
+ ExpAverage(ExpAverage(ExpAverage(SVAPOBase, period), period), period);
SVAPO.setDefaultColor(color.cyan);

plot upperSDLine = devH*Stdev(SVAPO,stdevper);
upperSDLine.setDefaultColor(color.red);
upperSDLine.setStyle(curve.SHORT_DASH);
plot lowerSDLine = -devL*Stdev(SVAPO,stdevper);
lowerSDLine.setDefaultColor(color.green);
lowerSDLine.setStyle(curve.SHORT_DASH);
plot zero = 0;
zero.setDefaultColor(color.white);

4 Responses to “Short Term Volume and Price Oscillator”

  1. Walstib says:

    When I copy and paste the code into a “new” study window and add it to a chart, the tittle showed in red.
    So I went back and selected “edit” to look through the code. I found three areas that where high lioghted in red.
    Starting from the 8th line from the bottom, “stdevper” was the first.
    The 5th line from the bottom had 2, “devL” and again “stdevper”.
    Is there something I’m doing wrong?
    Thanks in advance!

  2. That’s the “New” TOS script editor….it doesn’t like cutting and pasting from a web browser. There are hidden linefeed characters that need to be removed. Check around the end of each line at the semicolon for some hidden characters and delete them.

  3. Walstib says:

    Would importing work better?

  4. Srecko says:

    Data for the study which is based on the interval of 1 min. Because it contains a number of elementranih trading value at the primary level is distorted. So each indicator based on such data is not that not true, but on the contrary can create the illusion that we damage during trading.

Leave a Reply