snappyfrog 731 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 731 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 731 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 731 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?
|
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
|
push5280 201 posts msg #152770 - Ignore push5280 |
6/25/2020 4:54:34 PM
added bullish and bearish crossover
|
push5280 201 posts msg #152777 - Ignore push5280 |
6/25/2020 7:04:57 PM
Ok, I think this is everything :)
|
snappyfrog 731 posts msg #152782 - Ignore snappyfrog |
6/25/2020 10:04:37 PM
Wow, thanks Push
|