StockFetcher Forums · General Discussion · Volume Zone Oscillator<< 1 2 >>Post Follow-up
snappyfrog
721 posts
msg #152761
Ignore snappyfrog
6/25/2020 8:44:44 AM

This is a pumped up OBV basically. Can someone with greater skills try to write this?

This is a short read with the formula.

https://www.investopedia.com/articles/active-trading/072815/how-interpret-volume-zone-oscillator.asp

snappyfrog
721 posts
msg #152762
Ignore snappyfrog
6/25/2020 9:00:49 AM

ToS Script:

plot VZO = 100 * VP / TV;
plot VZO_DOTS = 100 * VP / TV;
plot "+60" = 60;
plot "+40" = 40;
#plot "+15" = 15;
#plot "-5" = -5;
plot "-40" = -40;
plot "-60" = -60;
plot ZeroLine = 0;

VP = volume position = X - period EMA (+/- volume)
TV = total volume = X - period EMA (volume)

snappyfrog
721 posts
msg #152764
Ignore snappyfrog
6/25/2020 10:36:48 AM

Here is an advanced ToS script:

#Indicator Name: Advanced VZO
#Contains built-in ThinkOrSwim code from VolumeZoneOscillator() and TOS documentation


declare lower;

input length = 14;

def VP = ExpAverage(Sign(close - close[1]) * volume, length);
def TV = ExpAverage(volume, length);

plot VZO = 100 * VP / TV;
plot VZO_DOTS = 100 * VP / TV;
plot "+60" = 60;
plot "+40" = 40;
#plot "+15" = 15;
#plot "-5" = -5;
plot "-40" = -40;
plot "-60" = -60;
plot ZeroLine = 0;

VZO.SetDefaultColor(GetColor(1));
"+60".SetDefaultColor(GetColor(6));
"+40".SetDefaultColor(GetColor(6));
#"+15".SetDefaultColor(GetColor(3));
#"-5".SetDefaultColor(GetColor(3));
"-40".SetDefaultColor(GetColor(5));
"-60".SetDefaultColor(GetColor(5));
ZeroLine.SetDefaultColor(GetColor(4));


def ADX = ADX(14);
def EMA60 = ExpAverage(close, 60);

def trendExistence = ADX > 18;
#1 - crosses above EMA60, 2 - above EMA60, 3 - crossing below EMA60, 4 - below EMA60
def direction = if close > EMA60 and close[1] <= EMA60 then 1 else if close > EMA60 and close[1] >= EMA60 then 2 else if close < EMA60 and close[1] >= EMA60 then 3 else 4;

def bullishCrossover = if VZO >= 40 and VZO[1] < 40 then 1 else 0;
def bearishCrossover = if VZO <= -40 and VZO[1] > -40 then 1 else 0;

AddCloud(40, 60, color.green, color.green);
AddCloud(-40,-60, color.red, color.red);
VZO.AssignValueColor(if VZO > 15 then color.green else if VZO > -5 then color.yellow else color.red);
VZO_DOTS.SetPaintingStrategy(PaintingStrategy.POINTS);
VZO_DOTS.AssignValueColor(if VZO > 15 then color.green else if VZO > -5 then color.yellow else color.red);
VZO_DOTS.SetLineWeight(3);



declare upper;

input length = 14;

def VP = ExpAverage(Sign(close - close[1]) * volume, length);
def TV = ExpAverage(volume, length);

def VZO = 100 * VP / TV;


def ADX = ADX(14);
def EMA60 = ExpAverage(close, 60);

def trendExistence = ADX > 18;
#1 - crosses above EMA60, 2 - above EMA60, 3 - crossing below EMA60, 4 - below EMA60
def direction = if close > EMA60 and close[1] <= EMA60 then 1 else if close > EMA60 and close[1] >= EMA60 then 2 else if close < EMA60 and close[1] >= EMA60 then 3 else 4;

def bullishCrossover = if VZO >= 40 and VZO[1] < 40 then 1 else 0;
def bearishCrossover = if VZO <= -40 and VZO[1] > -40 then 1 else 0;

plot bullSignal = if trendExistence == 1 and direction == 1 and bullishCrossover then 1 else 0;
bullSignal.setPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullSignal.SetLineWeight(5);

plot bearSignal = if trendExistence == 1 and direction == 3 and bearishCrossover then 1 else 0;
bearSignal.setPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearSignal.SetLineWeight(5);

AssignPriceColor(if VZO > 15 then color.green else if VZO > -5 then color.yellow else color.red);


snappyfrog
721 posts
msg #152765
Ignore snappyfrog
6/25/2020 1:10:05 PM

What this looks like in ToS


push5280
201 posts
msg #152767
Ignore push5280
6/25/2020 4:31:45 PM

something like this?

Fetcher[
set{var1, close - close 1 day ago}
set{var2, sign(var1)}
set{var3, var2 * volume}
set{VP, cema(var3,14)}
set{TV, cema(volume,14)}
set{var4, VP / TV}
set{VZO, 100 * var4}
draw VZO
draw VZO line at 60
draw VZO line at 40
draw VZO line at 15
draw VZO line at -15
draw VZO line at -40
draw VZO line at -60
]



push5280
201 posts
msg #152768
Ignore push5280
6/25/2020 4:37:32 PM

added ADX(14) and ema(60)

/* Volume Zone Oscillator*/
set{var1, close - close 1 day ago}
set{var2, sign(var1)}
set{var3, var2 * volume}
set{VP, cema(var3,14)}
set{TV, cema(volume,14)}
set{var4, VP / TV}
set{VZO, 100 * var4}

/*Criteria*/
Close > 1
average volume(252) > 250,000
average volume(8) > 250,000

/* Charting*/
draw ema(60)
draw VZO
draw VZO line at 60
draw VZO line at 40
draw VZO line at 15
draw VZO line at -15
draw VZO line at -40
draw VZO line at -60
draw ADX(14) line at 18
/* display */
Chart-time is 252 days

push5280
201 posts
msg #152769
Ignore push5280
6/25/2020 4:38:47 PM

clickable

Fetcher[
/* Volume Zone Oscillator*/
set{var1, close - close 1 day ago}
set{var2, sign(var1)}
set{var3, var2 * volume}
set{VP, cema(var3,14)}
set{TV, cema(volume,14)}
set{var4, VP / TV}
set{VZO, 100 * var4}

/*Criteria*/
Close > 1
average volume(252) > 250,000
average volume(8) > 250,000

/* Charting*/
draw ema(60)
draw VZO
draw VZO line at 60
draw VZO line at 40
draw VZO line at 15
draw VZO line at -15
draw VZO line at -40
draw VZO line at -60
draw ADX(14) line at 18
/* display */
Chart-time is 252 days
]



push5280
201 posts
msg #152770
Ignore push5280
6/25/2020 4:54:34 PM

added bullish and bearish crossover
Fetcher[
/* Volume Zone Oscillator*/
set{var1, close - close 1 day ago}
set{var2, sign(var1)}
set{var3, var2 * volume}
set{VP, cema(var3,14)}
set{TV, cema(volume,14)}
set{var4, VP / TV}
set{VZO, 100 * var4}
/*Crossovers*/
set{cross1, count(VZO 1 day ago < 40, 1)}
set{cross2, count(VZO > 40, 1)}
set{cross3, cross1 + cross2}
set{BullCross, count(cross3 > 1.99, 1)}
set{cross4, count(VZO 1 day ago > 40, 1)}
set{cross5, count(VZO < 40, 1)}
set{cross6, cross4 + cross5}
set{BearCross, count(cross6 > 1.99, 1)}
/*Criteria*/
Close > 1
average volume(252) > 250,000
average volume(8) > 250,000

/* Charting*/
draw ema(60)
draw BullCross
draw BearCross
draw VZO
draw VZO line at 60
draw VZO line at 40
draw VZO line at 15
draw VZO line at -15
draw VZO line at -40
draw VZO line at -60
draw ADX(14) line at 18
/* display */
Chart-time is 252 days
]



push5280
201 posts
msg #152777
Ignore push5280
6/25/2020 7:04:57 PM

Ok, I think this is everything :)

Fetcher[
/* Volume Zone Oscillator*/
set{var1, close - close 1 day ago}
set{var2, sign(var1)}
set{var3, var2 * volume}
set{VP, cema(var3,14)}
set{TV, cema(volume,14)}
set{var4, VP / TV}
set{VZO, 100 * var4}
/*Crossovers*/
set{cross1, count(VZO 1 day ago < 40, 1)}
set{cross2, count(VZO > 40, 1)}
set{cross3, cross1 + cross2}
set{BullCross, count(cross3 > 1.99, 1)}
set{cross4, count(VZO 1 day ago > 40, 1)}
set{cross5, count(VZO < 40, 1)}
set{cross6, cross4 + cross5}
set{BearCross, count(cross6 > 1.99, 1)}
/*ADX trend*/
set{trendEx, count(ADX(14) > 18, 1)}
/* Trend Direction*/
set{dir1, count(close > ema(60), 1)}
set{dir2, count(close 1 day ago < ema(60), 1)}
set{dir3, count(close < ema(60), 1)}
set{dir4, count(close 1 day ago > ema(60), 1)}
set{dir5, dir1 + dir2}
set{dir6, dir3 + dir4}
set{dir7, count(dir5 > 1.99, 1)}
set{dir8, count(dir6 < 1.99, 1)}
/*Bull and Bear Signal*/
set{sig1, trendEx + dir7}
set{sig2, sig1 + BullCross}
set{BullSignal, count(sig2 > 2.99, 1)}
set{sig3, trendEx + dir8}
set{sig4, sig3 + BearCross}
set{BearSignal, count(sig4 > 2.99, 1)}


/*Criteria*/
Close > 1
average volume(252) > 250,000
average volume(8) > 250,000


/* Charting*/
draw ema(60)
draw BullSignal
draw BearSignal
draw trendEx
draw BullCross
draw BearCross

draw VZO
draw VZO line at 60
draw VZO line at 40
draw VZO line at 15
draw VZO line at -15
draw VZO line at -40
draw VZO line at -60
draw ADX(14) line at 18
/* display */
Chart-time is 252 days
]



snappyfrog
721 posts
msg #152782
Ignore snappyfrog
6/25/2020 10:04:37 PM

Wow, thanks Push

StockFetcher Forums · General Discussion · Volume Zone Oscillator<< 1 2 >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.