# Float As Cumulative Volume Pivots
# Mobius
# Chat Room Request 10.04.2015
# V.02
# Added a condition to start cumulative count at the first peak or trough on a chart.
input FloatFor = "SPY"; #hint FloatFor: ETF's do not have a float. Total shares outstanding are adjusted to control NAV (Net Asset Value). Check them often for available shares.
input Float = 877632000; #hint Float: Share Float or for ETF's available shares
input n = 21; #hint n: length used for average volume.
AddLabel(GetSymbol() == FloatFor, "Float Value For: " + FloatFor, color.white);
def h = high;
def l = low;
def c = close;
def V = volume;
def AvgFloatP = Float / Average(V, n);
def HighestHigh = HighestAll(h);
def HighBar = if H == HighestHigh
then BarNumber()
else HighBar[1];
def LowestLow = LowestAll(l);
def LowBar = if L == LowestLow
then BarNumber()
else LowBar[1];
def FirstBar = if HighBar < LowBar
then HighBar
else LowBar;
def CumVolume = if barNumber() > FirstBar
then CompoundValue(1, if CumVolume[1] < Float
then CumVolume[1] + v
else if CumVolume[1] crosses Float
then 0
else CumVolume[1], v)
else 0;
plot CVpoint = if GetSymbol() == FloatFor and
CumVolume crosses above Float
then c
else double.nan;
CVpoint.SetPaintingStrategy(PaintingStrategy.Points);
CVpoint.SetLineWeight(4);
CVpoint.SetDefaultColor(Color.Yellow);
plot CVline = if GetSymbol() == FloatFor and
CumVolume crosses above Float
then c
else double.nan;
CVline.SetPaintingStrategy(PaintingStrategy.Line);
CVline.EnableApproximation();
CVLine.SetDefaultColor(Color.Yellow);
addLabel(GetSymbol() == FloatFor, "Float = " + Float + " Float/Avg Bars = " + Round(AvgFloatP, 0) + " Cumulative Volume = " + CumVolume, color.white);