my trading method has changed and I do not want to steer anybody wrong or making continuous annoying posts.
https://usethinkscript.com/threads/...n-and-average-for-thinkorswim.853/#post-93963
Here is the code. Remember the "smart money" control the markets.
declare lower;
# BetterVolume
# Adapted from the BetterVolume Indicator:
#
http://emini-watch.com/free-stuff/volume-indicator/
# By
#
http://thinkscripter.wordpress.com
# thinkscripter@...
# Last Update 19 APR 2009
# 7/25/2010 Re-written to include:
# - user selectable volume color bars
# - the option to turn price color bars off
# - there is no min v/r function in this study (formerly painted as a Climax Down bar)
# See forum thread discussion for important information about the study
# 8/2/2010 'Magenta toxicity' is now absent.
# 8/3/2010:
# The previous versions had the possibility of painting HighVolumeChurn bars when the
# condition was also a low volume condition. In this study low volume takes precedence.
# 8/4/2010: rev 3: Well the above didn't fix the low volume/high volume churn as I had expected.
# This fix should.
# 8/4/2010 Replaced Simple MA on Volume with Wilders Average (2 period)
# 8/5/2010 Added Price Volatility Spike Color Bar
#declare on_volume;
declare real_size;
input MA_Period = 10;
input LookBack = 10;
input ShowColorOnPrice = Yes;
def closeLog = Log(close[1] / close[2]);
def SDeva = StDev(closeLog, LookBack) * Sqrt(LookBack / (LookBack - 1));
def m = SDeva * close[1];
def spike = (close[0] - close[1]) / m;
def PriceColor = ShowColorOnPrice && volume;
def Range = high - low;
def VxR = volume * Range;
def VperR = if Range <> 0 then volume / Range else 0;
def LowVolume = volume == Lowest(volume, LookBack);
def ClimaxUp = VxR == Highest(VxR, LookBack) && close > open && !LowVolume;
def ClimaxDn = VxR == Highest(VxR, LookBack) && close < open && !LowVolume;
def HighVolumeChurn = VperR == Highest(VperR, LookBack) && !LowVolume;
def ClimaxChurn = (ClimaxUp or ClimaxDn) && HighVolumeChurn;
plot BetterVolume = volume;
BetterVolume.DefineColor("ClimaxUpColor", Color.RED);
BetterVolume.DefineColor("ClimaxDnColor", Color.WHITE);
BetterVolume.DefineColor("HighVolumeChurnColor", CreateColor(51, 102, 255));
BetterVolume.DefineColor("LowVolumeColor", Color.YELLOW);
BetterVolume.DefineColor("ClimaxChurnColor", Color.MAGENTA);
BetterVolume.DefineColor("DefaultColor", CreateColor(51, 51, 51));
BetterVolume.DefineColor("PriceChurnColor", Color.LIGHT_GREEN);
BetterVolume.DefineColor("SpikeColor", Color.CYAN);
#plot AverageVolume = Average(volume, MA_Period);
#AverageVolume.SetDefaultColor(color.red);
plot WilderAveVol = WildersAverage(volume, 2);
WilderAveVol.SetDefaultColor(CreateColor(128, 128, 128));
BetterVolume.AssignValueColor ( if ClimaxChurn then BetterVolume.Color("ClimaxChurnColor") else
if ClimaxUp then BetterVolume.Color("ClimaxUpColor") else
if ClimaxDn then BetterVolume.Color("ClimaxDnColor") else
if HighVolumeChurn then BetterVolume.Color("HighVolumeChurnColor") else
if LowVolume then BetterVolume.Color("LowVolumeColor")
else BetterVolume.Color("DefaultColor"));
BetterVolume.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BetterVolume.SetLineWeight(5);
AssignPriceColor( if spike > 3.0 or spike < -3.0 then BetterVolume.Color("SpikeColor") else if ClimaxChurn && PriceColor then BetterVolume.Color("ClimaxChurnColor") else
if ClimaxUp && PriceColor then BetterVolume.Color("ClimaxUpColor") else
if ClimaxDn && PriceColor then BetterVolume.Color("ClimaxDnColor") else
if HighVolumeChurn && PriceColor then BetterVolume.Color("PriceChurnColor") else
if LowVolume && PriceColor then BetterVolume.Color("LowVolumeColor") else
if PriceColor then BetterVolume.Color("DefaultColor") else
Color.CURRENT);
#
# *************************************************************
# INDICATOR'S COLOR LEGEND
# *************************************************************
AddLabel(yes, "Amateur Trading", BetterVolume.Color("LowVolumeColor"));
AddLabel(yes, "Smart Money Volume Churn", BetterVolume.Color("HighVolumeChurnColor"));
AddLabel(yes, "Smart Money Price Churn", BetterVolume.Color("PriceChurnColor"));
AddLabel(yes, "Climax Down", BetterVolume.Color("ClimaxDnColor"));
AddLabel(yes, "Climax Up", BetterVolume.Color("ClimaxUpColor"));
AddLabel(yes, "Climax Churn", BetterVolume.Color("ClimaxChurnColor"));
AddLabel(yes, "Smart Money Spike", BetterVolume.Color("SpikeColor"));
AddLabel(yes, "Normal", BetterVolume.Color("DefaultColor"));
Hope you understand everything and good luck trading. Feel free to ask any questions you like!
Thanks for your time. --Keith