D > Save this
I don't know if it works but look at the code
Key Words in 2nd one >> "Add Cloud"
will mess with this later
=================================================
Bollinger Band indicator.
input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input pct_pierce = 1.0000;
def sDev = stdev(data = price[-displace], length = length);
plot MidLine = ExpAverage(data = price[-displace], length = length);
plot LowerBand = MidLine + num_Dev_Dn * sDev;
plot UpperBand = MidLine + num_Dev_Up * sDev;
plot LowRiskLong = midline + (upperBand - midLine)/4;
plot LowRiskShort = midline - (midline - lowerBand)/4;
plot UpperPierce = upperband * (1 + pct_pierce/100);
plot LowerPierce = lowerband * (1 - pct_pierce/100);
LowerBand.SetDefaultColor(GetColor(0));
MidLine.SetDefaultColor(GetColor(1));
UpperBand.SetDefaultColor(GetColor(5));
==================================================
declare lower;
input days = 252;
input upperRange = 20;
input midUpperRange = 40;
input midLowerRange = 40;
input lowerRange = 20;
plot iv = round(impVolatility()*100);
plot hv = round(historicalVolatility()*100);
plot highIV = highest(iv, days);
plot lowIV = lowest(hv, 252);
def upperPct = upperRange/100;
def midUpperPct = midUpperRange/100;
def midLowerPct = midLowerRange/100;
def lowerPct = lowerRange/100;
def yearlyRange = highIV - lowIV;
plot upperPlot = highIV - yearlyRange*upperPct;
plot midUpperPlot = highIV - yearlyRange*midUpperPct;
plot midLowerPlot = lowIV + yearlyRange*midLowerPct;
plot lowerPlot = lowIV + yearlyRange*lowerPct;
addCloud(highIV, upperPlot, color.GREEN);
addCloud(lowIV, lowerPlot, color.RED);
addcloud(midUpperPlot, midLowerPlot, color.Yellow);
highIV.setDefaultColor(color.GREEN);
lowIV.setDefaultColor(color.RED);
upperPlot.setDefaultColor(color.GREEN);
midUpperPlot.setDefaultColor(color.Black);
midLowerPlot.setDefaultColor(color.Black);
lowerPlot.setDefaultColor(color.RED);
Disaster is Only a Keystroke Away!