Dallas, TX
Posts: 1 since Mar 2019
Thanks Given: 0
Thanks Received: 0
|
My tos study is supposed to show status of squeeze on multiple time frames in labels.
It suddenly stopped displaying for time-frames in min and hours. Monthly, Weekly, and Daily are displaying correctly.
If you could help, I really appreciate it. Thank you.
input period = aggregationPeriod.DAY;
DefineGLobalColor("In Squeeze", color.red);
DefineGlobalCOlor("Not In Squeeze", color.dark_green);
script SymbolSqueeze {
input aP = aggregationPeriod.DAY;
def nBB = 2.0;
def Length = 20.0;
def factor = 1.5;
def price1 = close( period = aP);
def UpperBand = MovingAverage(AverageType.Simple, data = price1, length = length) + nBB * stdev(data = price1, length = length);
def shift = factor * MovingAverage(AverageType.Simple, TrueRange(high( period=aP), close( period=aP), low( period=aP)), length);
def average = MovingAverage(AverageType.Simple, price1, length);
def Avg = average;
def Upper_Band = MovingAverage(AverageType.Simple, price1, length)+ shift;
plot BolKelDelta = UpperBand-Upper_Band;
}
def currentPeriod = getAggregationPeriod();
def s1;
if period >= currentPeriod {
s1 = SymbolSqueeze( aP = period);
} else {
s1 = double.nan;
}
AddLabel(!isNan(s1),if period == aggregationPeriod.MONTH then "M"
else
if period == aggregationPeriod.WEEK then "W"
else
if period == aggregationPeriod.FOUR_DAYS then "4D"
else
if period == aggregationPeriod.THREE_DAYS then "3D"
else
if period == aggregationPeriod.TWO_DAYS then "2D"
else
if period == aggregationPeriod.DAY then "D"
else
if period == aggregationPeriod.FOUR_HOURS then "4H"
else
if period == aggregationPeriod.TWO_HOURS then "2H"
else
if period == aggregationPeriod.HOUR then "60m"
else
if period == aggregationPeriod.THIRTY_MIN then "30m"
else
if period == aggregationPeriod.TWENTY_MIN then "20m"
else
if period == aggregationPeriod.FIFTEEN_MIN then "15m"
else
if period == aggregationPeriod.TEN_MIN then "10m"
else
if period == aggregationPeriod.FIVE_MIN then "5m"
else
if period == aggregationPeriod.FOUR_MIN then "4m"
else
if period == aggregationPeriod.THREE_MIN then "3m"
else
if period == aggregationPeriod.TWO_MIN then "2m"
else
if period == aggregationPeriod.MIN then "1m"
else "", if s1 > 0 then GlobalColor("Not In Squeeze") else GlobalColor("In Squeeze"));
|