VZO- Volume Zone Oscillator for ThinkorSwim (modified with alerts/color scheme)

chewie76

Active member
VIP
VIP Enthusiast
I added alerts for when VZO enters and exits the buy and sell zones. Also updated color scheme. No other changes to it.

KdKXz9E.png


Shareable link.
http://tos.mx/zCEpFos

Code:
# VZO
# Modified by Chewie
# Added alerts for entering and exiting the buy and sell zones
# and updated the color scheme 12/20/20
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
declare lower;

input length = 14;
input AlertsOn = yes;
def VP = ExpAverage(Sign(close - close[1]) * volume, length);
def TV = ExpAverage(volume, length);
plot VZO = 100 * VP / TV;
plot "+60" = 60;
plot "+40" = 40;
plot "-40" = -40;
plot "-60" = -60;
plot ZeroLine = 0;

VZO.DefineColor("Normal", color.white);
VZO.DefineColor("OverBought", color.red);
VZO.DefineColor("OverSold", color.green);
VZO.AssignValueColor(if VZO > "+60" then VZO.Color("OverBought") else if VZO < "-60" then VZO.Color("OverSold") else VZO.Color("Normal"));
"+60".SetDefaultColor(color.red);
"+40".SetDefaultColor(color.red);
"-40".SetDefaultColor(color.green);
"-60".SetDefaultColor(color.green);
ZeroLine.SetDefaultColor(color.yellow);

AddCloud("+60", "+40", Color.dark_RED, Color.CURRENT);
AddCloud("-40", "-60", Color.dark_GREEN, Color.CURRENT);

AddCloud(VZO, "+40", Color.RED, Color.CURRENT);
AddCloud("-40", VZO, Color.GREEN, Color.CURRENT);

def condition1 = VZO crosses above "+40";
def condition2 = VZO crosses below "+40";
def condition3 = VZO crosses below "-40";
def condition4 = VZO crosses above "-40";

# Alert
Alert(alertsOn and condition1, "Enter Sell Zone", Alert.BAR, Sound.RING);
Alert(alertsOn and condition2, "Exit Sell Zone", Alert.BAR, Sound.bell);
Alert(alertsOn and condition3, "Enter Buy Zone", Alert.BAR, Sound.RING);
Alert(alertsOn and condition4, "Exit Buy Zone", Alert.BAR, Sound.bell);
 

Similar threads

Top