can someone look at this and tell me what i did wrong.
## min aggregationPeriod variables
input oneaggregationPeriod = AggregationPeriod.MIN;
def minprice = close(period = AggregationPeriod.MIN);
def minEMA89 = ExpAverage(close, 89);
def minEMA55 = ExpAverage(close, 55);
def minEMA34 = ExpAverage(close, 34);
def minEMA21 = ExpAverage(close, 21);
def minEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def minSP = minEMA8 > minEMA21 and minEMA21 > minEMA34 and minEMA34 > minEMA55 and minEMA55 > minEMA89;
def minSN = minEMA8 < minEMA21 and minEMA21 < minEMA34 and minEMA34 < minEMA55 and minEMA55 < minEMA89;
def minSPW = minEMA8 < minEMA21 and minEMA34 > minEMA55 and minEMA55 > minEMA89;
def minSNW = minEMA8 > minEMA21 and minEMA34 < minEMA55 and minEMA55 < minEMA89;
AddLabel(yes, "1M", if minSP then GlobalColor("StackedPositive") else if minSN then GlobalColor("StackedNegative") else if (minSPW or minSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## two aggregationPeriod variables
input twoaggregationPeriod = AggregationPeriod.TWO_MIN;
def twoprice = close(period = AggregationPeriod.TWO_MIN);
def twoEMA89 = ExpAverage(close, 89);
def twoEMA55 = ExpAverage(close, 55);
def twoEMA34 = ExpAverage(close, 34);
def twoEMA21 = ExpAverage(close, 21);
def twoEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def twoSP = twoEMA8 > twoEMA21 and twoEMA21 > twoEMA34 and twoEMA34 > twoEMA55 and twoEMA55 > twoEMA89;
def twoSN = twoEMA8 < twoEMA21 and twoEMA21 < twoEMA34 and twoEMA34 < twoEMA55 and twoEMA55 < twoEMA89;
def twoSPW = twoEMA8 < twoEMA21 and twoEMA34 > twoEMA55 and twoEMA55 > twoEMA89;
def twoSNW = twoEMA8 > twoEMA21 and twoEMA34 < twoEMA55 and twoEMA55 < twoEMA89;
AddLabel(yes, "2M", if twoSP then GlobalColor("StackedPositive") else if twoSN then GlobalColor("StackedNegative") else if (twoSPW or twoSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## three aggregationPeriod variables
input threeaggregationPeriod = AggregationPeriod.THREE_MIN;
def threeprice = close(period = AggregationPeriod.THREE_MIN);
def threeEMA89 = ExpAverage(close, 89);
def threeEMA55 = ExpAverage(close, 55);
def threeEMA34 = ExpAverage(close, 34);
def threeEMA21 = ExpAverage(close, 21);
def threeEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def threeSP = threeEMA8 > threeEMA21 and threeEMA21 > threeEMA34 and threeEMA34 > threeEMA55 and threeEMA55 > threeEMA89;
def threeSN = threeEMA8 < threeEMA21 and threeEMA21 < threeEMA34 and threeEMA34 < threeEMA55 and threeEMA55 < threeEMA89;
def threeSPW = threeEMA8 < threeEMA21 and threeEMA34 > threeEMA55 and threeEMA55 > threeEMA89;
def threeSNW = threeEMA8 > threeEMA21 and threeEMA34 < threeEMA55 and threeEMA55 < threeEMA89;
AddLabel(yes, "3M", if threeSP then GlobalColor("StackedPositive") else if threeSN then GlobalColor("StackedNegative") else if (threeSPW or threeSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## five aggregationPeriod variables
input fiveaggregationPeriod = AggregationPeriod.FIVE_MIN;
def fiveprice = close(period = AggregationPeriod.FIVE_MIN);
def fiveEMA89 = ExpAverage(close, 89);
def fiveEMA55 = ExpAverage(close, 55);
def fiveEMA34 = ExpAverage(close, 34);
def fiveEMA21 = ExpAverage(close, 21);
def fiveEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def fivesP = fiveEMA8 > fiveEMA21 and fiveEMA21 > fiveEMA34 and fiveEMA34 > fiveEMA55 and fiveEMA55 > fiveEMA89;
def fiveSN = fiveEMA8 < fiveEMA21 and fiveEMA21 < fiveEMA34 and fiveEMA34 < fiveEMA55 and fiveEMA55 < fiveEMA89;
def fiveSPW = fiveEMA8 < fiveEMA21 and fiveEMA34 > fiveEMA55 and fiveEMA55 > fiveEMA89;
def fiveSNW = fiveEMA8 > threeEMA21 and threeEMA34 < threeEMA55 and fiveEMA55 < fiveEMA89;
AddLabel(yes, "5M", if fiveSP then GlobalColor("StackedPositive") else if fiveSN then GlobalColor("StackedNegative") else if (fiveSPW or fiveSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## ten aggregationPeriod variables
input tenaggregationPeriod = AggregationPeriod.TEN_MIN;
def tenprice = close(period = AggregationPeriod.TEN_MIN);
def tenEMA89 = ExpAverage(close, 89);
def tenEMA55 = ExpAverage(close, 55);
def tenEMA34 = ExpAverage(close, 34);
def tenEMA21 = ExpAverage(close, 21);
def tenEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def tenSP = tenEMA8 > tenEMA21 and tenEMA21 > tenEMA34 and tenEMA34 > tenEMA55 and tenEMA55 > tenEMA89;
def tenSN = tenEMA8 < tenEMA21 and tenEMA21 < tenEMA34 and tenEMA34 < tenEMA55 and tenEMA55 < tenEMA89;
def tenSPW = tenEMA8 < tenEMA21 and tenEMA34 > tenEMA55 and tenEMA55 > tenEMA89;
def tenSNW = tenEMA8 > tenEMA21 and tenEMA34 < tenEMA55 and tenEMA55 < tenEMA89;
AddLabel(yes, "10M", if tenSP then GlobalColor("StackedPositive") else if tenSN then GlobalColor("StackedNegative") else if (tenSPW or tenSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## fifteen aggregationPeriod variables
input fifteenaggregationPeriod = AggregationPeriod.FIFTEEN_MIN;
def fifteenprice = close(period = AggregationPeriod.fifteen_MIN);
def fifteenEMA89 = ExpAverage(close, 89);
def fifteenEMA55 = ExpAverage(close, 55);
def fifteenEMA34 = ExpAverage(close, 34);
def fifteenEMA21 = ExpAverage(close, 21);
def fifteenEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def fifteenSP = fifteenEMA8 > fifteenEMA21 and fifteenEMA21 > fifteenEMA34 and fifteenEMA34 > fifteenEMA55 and fifteenEMA55 > fifteenEMA89;
def fifteenSN = fifteenEMA8 < fifteenEMA21 and fifteenEMA21 < fifteenEMA34 and fifteenEMA34 < fifteenEMA55 and fifteenEMA55 < fifteenEMA89;
def fifteenSPW = fifteenEMA8 < fifteenEMA21 and fifteenEMA34 > fifteenEMA55 and fifteenEMA55 > fifteenEMA89;
def fifteenSNW = fifteenEMA8 > fifteenEMA21 and fifteenEMA34 < fifteenEMA55 and fifteenEMA55 < fifteenEMA89;
AddLabel(yes, "15M", if fifteenSP then GlobalColor("StackedPositive") else if fifteenSN then GlobalColor("StackedNegative") else if (fifteenSPW or fifteenSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## thirty aggregationPeriod variables
input thirtyaggregationPeriod = AggregationPeriod.THIRTY_MIN;
def thirtyprice = close(period = AggregationPeriod.THIRTY_MIN);
def thirtyEMA89 = ExpAverage(close, 89);
def thirtyEMA55 = ExpAverage(close, 55);
def thirtyEMA34 = ExpAverage(close, 34);
def thirtyEMA21 = ExpAverage(close, 21);
def thirtyEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def thirtySP = thirtyEMA8 > thirtyEMA21 and thirtyEMA21 > thirtyEMA34 and thirtyEMA34 > thirtyEMA55 and thirtyEMA55 > thirtyEMA89;
def thirtySN = thirtyEMA8 < thirtyEMA21 and thirtyEMA21 < thirtyEMA34 and thirtyEMA34 < thirtyEMA55 and thirtyEMA55 < thirtyEMA89;
def thirtySPW = thirtyEMA8 < thirtyEMA21 and thirtyEMA34 > thirtyEMA55 and thirtyEMA55 > thirtyEMA89;
def thirtySNW = thirtyEMA8 > thirtyEMA21 and thirtyEMA34 < thirtyEMA55 and thirtyEMA55 < thirtyEMA89;
AddLabel(yes, "30M", if thirtySP then GlobalColor("StackedPositive") else if thirtySN then GlobalColor("StackedNegative") else if (thirtySPW or thirtySNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## hr aggregationPeriod variables
input hraggregationPeriod = AggregationPeriod.HOUR;
def hrprice = close(period = AggregationPeriod.HOur);
def hrEMA89 = ExpAverage(close, 89);
def hrEMA55 = ExpAverage(close, 55);
def hrEMA34 = ExpAverage(close, 34);
def hrEMA21 = ExpAverage(close, 21);
def hrEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def hrSP = hrEMA8 > hrEMA21 and hrEMA21 > hrEMA34 and hrEMA34 > hrEMA55 and hrEMA55 > hrEMA89;
def hrSN = hrEMA8 < hrEMA21 and hrEMA21 < hrEMA34 and hrEMA34 < hrEMA55 and hrEMA55 < hrEMA89;
def hrSPW = hrEMA8 < hrEMA21 and hrEMA34 > hrEMA55 and hrEMA55 > hrEMA89;
def hrSNW = hrEMA8 > hrEMA21 and hrEMA34 < hrEMA55 and hrEMA55 < hrEMA89;
AddLabel(yes, "1HR", if hrSP then GlobalColor("StackedPositive") else if hrSN then GlobalColor("StackedNegative") else if (hrSPW or hrSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## twoHR aggregationPeriod variables
input twohraggregationPeriod = AggregationPeriod.TWO_HOURS;
def twohrprice = close(period = AggregationPeriod.TWO_HOURS);
def twohrEMA89 = ExpAverage(close, 89);
def twohrEMA55 = ExpAverage(close, 55);
def twohrEMA34 = ExpAverage(close, 34);
def twohrEMA21 = ExpAverage(close, 21);
def twohrEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def twohrSP = twohrEMA8 > twohrEMA21 and twohrEMA21 > twohrEMA34 and twohrEMA34 > twohrEMA55 and twohrEMA55 > twohrEMA89;
def twohrSN = twohrEMA8 < twohrEMA21 and twohrEMA21 < twohrEMA34 and twohrEMA34 < twohrEMA55 and twohrEMA55 < twohrEMA89;
def twohrSPW = twohrEMA8 < twohrEMA21 and twohrEMA34 > twohrEMA55 and twohrEMA55 > twohrEMA89;
def twohrSNW = twohrEMA8 > twohrEMA21 and twohrEMA34 < twohrEMA55 and twohrEMA55 < twohrEMA89;
AddLabel(yes, "2HR", if twohrSP then GlobalColor("StackedPositive") else if twohrSN then GlobalColor("StackedNegative") else if (twohrSPW or twohrSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## fourhr aggregationPeriod variables
input fourhrggregationPeriod = AggregationPeriod.FOUR_HOURS;
def fourhrprice = close(period = AggregationPeriod.FOUR_HOURS);
def fourhrEMA89 = ExpAverage(close, 89);
def fourhrEMA55 = ExpAverage(close, 55);
def fourhrEMA34 = ExpAverage(close, 34);
def fourhrEMA21 = ExpAverage(close, 21);
def fourhrEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def fourhrSP = fourhrEMA8 > fourhrEMA21 and fourhrEMA21 > fourhrEMA34 and fourhrEMA34 > fourhrEMA55 and fourhrEMA55 > fourhrEMA89;
def fourhrSN = fourhrEMA8 < fourhrEMA21 and fourhrEMA21 < fourhrEMA34 and fourhrEMA34 < fourhrEMA55 and fourhrEMA55 < fourhrEMA89;
def fourhrSPW = fourhrEMA8 < fourhrEMA21 and fourhrEMA34 > fourhrEMA55 and fourhrEMA55 > fourhrEMA89;
def fourhrSNW = fourhrEMA8 > fourhrEMA21 and fourhrEMA34 < fourhrEMA55 and fourhrEMA55 < fourhrEMA89;
AddLabel(yes, "4HR", if fourhrSP then GlobalColor("StackedPositive") else if fourhrSN then GlobalColor("StackedNegative") else if (fourhrSPW or fourhrSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## day aggregationPeriod variables
input dayaggregationPeriod = AggregationPeriod.DAY;
def dayprice = close(period = AggregationPeriod.DAY);
def dayEMA89 = ExpAverage(close, 89);
def dayEMA55 = ExpAverage(close, 55);
def dayEMA34 = ExpAverage(close, 34);
def dayEMA21 = ExpAverage(close, 21);
def dayEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def daySP = dayEMA8 > dayEMA21 and dayEMA21 > dayEMA34 and dayEMA34 > dayEMA55 and dayEMA55 > dayEMA89;
def daySN = dayEMA8 < dayEMA21 and dayEMA21 < dayEMA34 and dayEMA34 < dayEMA55 and dayEMA55 < dayEMA89;
def daySPW = dayEMA8 < dayEMA21 and dayEMA34 > dayEMA55 and dayEMA55 > dayEMA89;
def daySNW = dayEMA8 > dayEMA21 and dayEMA21 < dayEMA55 and dayEMA55 < dayEMA89;
AddLabel(yes, "DAY", if daySP then GlobalColor("StackedPositive") else if daySN then GlobalColor("StackedNegative") else if (daySPW or daySNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## week aggregationPeriod variables
input weekaggregationPeriod = AggregationPeriod.WEEK;
def weekprice = close(period = AggregationPeriod.WEEK);
def weekEMA89 = ExpAverage(close, 89);
def weekEMA55 = ExpAverage(close, 55);
def weekEMA34 = ExpAverage(close, 34);
def weekEMA21 = ExpAverage(close, 21);
def weekEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def weekSP = weekEMA8 > weekEMA21 and weekEMA21 > weekEMA34 and weekEMA34 > weekEMA55 and weekEMA55 > weekEMA89;
def weekSN = weekEMA8 < weekEMA21 and weekEMA21 < weekEMA34 and weekEMA34 < weekEMA55 and weekEMA55 < weekEMA89;
def weekSPW = weekEMA8 < weekEMA21 and weekEMA34 > weekEMA55 and weekEMA55 > weekEMA89;
def weekSNW = weekEMA8 > weekEMA21 and weekEMA34 < weekEMA55 and weekEMA55 < weekEMA89;
AddLabel(yes, "WK", if WEEKSP then GlobalColor("StackedPositive") else if weekSN then GlobalColor("StackedNegative") else if (weekSPW or weekSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## min aggregationPeriod variables
input oneaggregationPeriod = AggregationPeriod.MIN;
def minprice = close(period = AggregationPeriod.MIN);
def minEMA89 = ExpAverage(close, 89);
def minEMA55 = ExpAverage(close, 55);
def minEMA34 = ExpAverage(close, 34);
def minEMA21 = ExpAverage(close, 21);
def minEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def minSP = minEMA8 > minEMA21 and minEMA21 > minEMA34 and minEMA34 > minEMA55 and minEMA55 > minEMA89;
def minSN = minEMA8 < minEMA21 and minEMA21 < minEMA34 and minEMA34 < minEMA55 and minEMA55 < minEMA89;
def minSPW = minEMA8 < minEMA21 and minEMA34 > minEMA55 and minEMA55 > minEMA89;
def minSNW = minEMA8 > minEMA21 and minEMA34 < minEMA55 and minEMA55 < minEMA89;
AddLabel(yes, "1M", if minSP then GlobalColor("StackedPositive") else if minSN then GlobalColor("StackedNegative") else if (minSPW or minSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## two aggregationPeriod variables
input twoaggregationPeriod = AggregationPeriod.TWO_MIN;
def twoprice = close(period = AggregationPeriod.TWO_MIN);
def twoEMA89 = ExpAverage(close, 89);
def twoEMA55 = ExpAverage(close, 55);
def twoEMA34 = ExpAverage(close, 34);
def twoEMA21 = ExpAverage(close, 21);
def twoEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def twoSP = twoEMA8 > twoEMA21 and twoEMA21 > twoEMA34 and twoEMA34 > twoEMA55 and twoEMA55 > twoEMA89;
def twoSN = twoEMA8 < twoEMA21 and twoEMA21 < twoEMA34 and twoEMA34 < twoEMA55 and twoEMA55 < twoEMA89;
def twoSPW = twoEMA8 < twoEMA21 and twoEMA34 > twoEMA55 and twoEMA55 > twoEMA89;
def twoSNW = twoEMA8 > twoEMA21 and twoEMA34 < twoEMA55 and twoEMA55 < twoEMA89;
AddLabel(yes, "2M", if twoSP then GlobalColor("StackedPositive") else if twoSN then GlobalColor("StackedNegative") else if (twoSPW or twoSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## three aggregationPeriod variables
input threeaggregationPeriod = AggregationPeriod.THREE_MIN;
def threeprice = close(period = AggregationPeriod.THREE_MIN);
def threeEMA89 = ExpAverage(close, 89);
def threeEMA55 = ExpAverage(close, 55);
def threeEMA34 = ExpAverage(close, 34);
def threeEMA21 = ExpAverage(close, 21);
def threeEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def threeSP = threeEMA8 > threeEMA21 and threeEMA21 > threeEMA34 and threeEMA34 > threeEMA55 and threeEMA55 > threeEMA89;
def threeSN = threeEMA8 < threeEMA21 and threeEMA21 < threeEMA34 and threeEMA34 < threeEMA55 and threeEMA55 < threeEMA89;
def threeSPW = threeEMA8 < threeEMA21 and threeEMA34 > threeEMA55 and threeEMA55 > threeEMA89;
def threeSNW = threeEMA8 > threeEMA21 and threeEMA34 < threeEMA55 and threeEMA55 < threeEMA89;
AddLabel(yes, "3M", if threeSP then GlobalColor("StackedPositive") else if threeSN then GlobalColor("StackedNegative") else if (threeSPW or threeSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## five aggregationPeriod variables
input fiveaggregationPeriod = AggregationPeriod.FIVE_MIN;
def fiveprice = close(period = AggregationPeriod.FIVE_MIN);
def fiveEMA89 = ExpAverage(close, 89);
def fiveEMA55 = ExpAverage(close, 55);
def fiveEMA34 = ExpAverage(close, 34);
def fiveEMA21 = ExpAverage(close, 21);
def fiveEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def fivesP = fiveEMA8 > fiveEMA21 and fiveEMA21 > fiveEMA34 and fiveEMA34 > fiveEMA55 and fiveEMA55 > fiveEMA89;
def fiveSN = fiveEMA8 < fiveEMA21 and fiveEMA21 < fiveEMA34 and fiveEMA34 < fiveEMA55 and fiveEMA55 < fiveEMA89;
def fiveSPW = fiveEMA8 < fiveEMA21 and fiveEMA34 > fiveEMA55 and fiveEMA55 > fiveEMA89;
def fiveSNW = fiveEMA8 > threeEMA21 and threeEMA34 < threeEMA55 and fiveEMA55 < fiveEMA89;
AddLabel(yes, "5M", if fiveSP then GlobalColor("StackedPositive") else if fiveSN then GlobalColor("StackedNegative") else if (fiveSPW or fiveSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## ten aggregationPeriod variables
input tenaggregationPeriod = AggregationPeriod.TEN_MIN;
def tenprice = close(period = AggregationPeriod.TEN_MIN);
def tenEMA89 = ExpAverage(close, 89);
def tenEMA55 = ExpAverage(close, 55);
def tenEMA34 = ExpAverage(close, 34);
def tenEMA21 = ExpAverage(close, 21);
def tenEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def tenSP = tenEMA8 > tenEMA21 and tenEMA21 > tenEMA34 and tenEMA34 > tenEMA55 and tenEMA55 > tenEMA89;
def tenSN = tenEMA8 < tenEMA21 and tenEMA21 < tenEMA34 and tenEMA34 < tenEMA55 and tenEMA55 < tenEMA89;
def tenSPW = tenEMA8 < tenEMA21 and tenEMA34 > tenEMA55 and tenEMA55 > tenEMA89;
def tenSNW = tenEMA8 > tenEMA21 and tenEMA34 < tenEMA55 and tenEMA55 < tenEMA89;
AddLabel(yes, "10M", if tenSP then GlobalColor("StackedPositive") else if tenSN then GlobalColor("StackedNegative") else if (tenSPW or tenSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## fifteen aggregationPeriod variables
input fifteenaggregationPeriod = AggregationPeriod.FIFTEEN_MIN;
def fifteenprice = close(period = AggregationPeriod.fifteen_MIN);
def fifteenEMA89 = ExpAverage(close, 89);
def fifteenEMA55 = ExpAverage(close, 55);
def fifteenEMA34 = ExpAverage(close, 34);
def fifteenEMA21 = ExpAverage(close, 21);
def fifteenEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def fifteenSP = fifteenEMA8 > fifteenEMA21 and fifteenEMA21 > fifteenEMA34 and fifteenEMA34 > fifteenEMA55 and fifteenEMA55 > fifteenEMA89;
def fifteenSN = fifteenEMA8 < fifteenEMA21 and fifteenEMA21 < fifteenEMA34 and fifteenEMA34 < fifteenEMA55 and fifteenEMA55 < fifteenEMA89;
def fifteenSPW = fifteenEMA8 < fifteenEMA21 and fifteenEMA34 > fifteenEMA55 and fifteenEMA55 > fifteenEMA89;
def fifteenSNW = fifteenEMA8 > fifteenEMA21 and fifteenEMA34 < fifteenEMA55 and fifteenEMA55 < fifteenEMA89;
AddLabel(yes, "15M", if fifteenSP then GlobalColor("StackedPositive") else if fifteenSN then GlobalColor("StackedNegative") else if (fifteenSPW or fifteenSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## thirty aggregationPeriod variables
input thirtyaggregationPeriod = AggregationPeriod.THIRTY_MIN;
def thirtyprice = close(period = AggregationPeriod.THIRTY_MIN);
def thirtyEMA89 = ExpAverage(close, 89);
def thirtyEMA55 = ExpAverage(close, 55);
def thirtyEMA34 = ExpAverage(close, 34);
def thirtyEMA21 = ExpAverage(close, 21);
def thirtyEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def thirtySP = thirtyEMA8 > thirtyEMA21 and thirtyEMA21 > thirtyEMA34 and thirtyEMA34 > thirtyEMA55 and thirtyEMA55 > thirtyEMA89;
def thirtySN = thirtyEMA8 < thirtyEMA21 and thirtyEMA21 < thirtyEMA34 and thirtyEMA34 < thirtyEMA55 and thirtyEMA55 < thirtyEMA89;
def thirtySPW = thirtyEMA8 < thirtyEMA21 and thirtyEMA34 > thirtyEMA55 and thirtyEMA55 > thirtyEMA89;
def thirtySNW = thirtyEMA8 > thirtyEMA21 and thirtyEMA34 < thirtyEMA55 and thirtyEMA55 < thirtyEMA89;
AddLabel(yes, "30M", if thirtySP then GlobalColor("StackedPositive") else if thirtySN then GlobalColor("StackedNegative") else if (thirtySPW or thirtySNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## hr aggregationPeriod variables
input hraggregationPeriod = AggregationPeriod.HOUR;
def hrprice = close(period = AggregationPeriod.HOur);
def hrEMA89 = ExpAverage(close, 89);
def hrEMA55 = ExpAverage(close, 55);
def hrEMA34 = ExpAverage(close, 34);
def hrEMA21 = ExpAverage(close, 21);
def hrEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def hrSP = hrEMA8 > hrEMA21 and hrEMA21 > hrEMA34 and hrEMA34 > hrEMA55 and hrEMA55 > hrEMA89;
def hrSN = hrEMA8 < hrEMA21 and hrEMA21 < hrEMA34 and hrEMA34 < hrEMA55 and hrEMA55 < hrEMA89;
def hrSPW = hrEMA8 < hrEMA21 and hrEMA34 > hrEMA55 and hrEMA55 > hrEMA89;
def hrSNW = hrEMA8 > hrEMA21 and hrEMA34 < hrEMA55 and hrEMA55 < hrEMA89;
AddLabel(yes, "1HR", if hrSP then GlobalColor("StackedPositive") else if hrSN then GlobalColor("StackedNegative") else if (hrSPW or hrSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## twoHR aggregationPeriod variables
input twohraggregationPeriod = AggregationPeriod.TWO_HOURS;
def twohrprice = close(period = AggregationPeriod.TWO_HOURS);
def twohrEMA89 = ExpAverage(close, 89);
def twohrEMA55 = ExpAverage(close, 55);
def twohrEMA34 = ExpAverage(close, 34);
def twohrEMA21 = ExpAverage(close, 21);
def twohrEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def twohrSP = twohrEMA8 > twohrEMA21 and twohrEMA21 > twohrEMA34 and twohrEMA34 > twohrEMA55 and twohrEMA55 > twohrEMA89;
def twohrSN = twohrEMA8 < twohrEMA21 and twohrEMA21 < twohrEMA34 and twohrEMA34 < twohrEMA55 and twohrEMA55 < twohrEMA89;
def twohrSPW = twohrEMA8 < twohrEMA21 and twohrEMA34 > twohrEMA55 and twohrEMA55 > twohrEMA89;
def twohrSNW = twohrEMA8 > twohrEMA21 and twohrEMA34 < twohrEMA55 and twohrEMA55 < twohrEMA89;
AddLabel(yes, "2HR", if twohrSP then GlobalColor("StackedPositive") else if twohrSN then GlobalColor("StackedNegative") else if (twohrSPW or twohrSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## fourhr aggregationPeriod variables
input fourhrggregationPeriod = AggregationPeriod.FOUR_HOURS;
def fourhrprice = close(period = AggregationPeriod.FOUR_HOURS);
def fourhrEMA89 = ExpAverage(close, 89);
def fourhrEMA55 = ExpAverage(close, 55);
def fourhrEMA34 = ExpAverage(close, 34);
def fourhrEMA21 = ExpAverage(close, 21);
def fourhrEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def fourhrSP = fourhrEMA8 > fourhrEMA21 and fourhrEMA21 > fourhrEMA34 and fourhrEMA34 > fourhrEMA55 and fourhrEMA55 > fourhrEMA89;
def fourhrSN = fourhrEMA8 < fourhrEMA21 and fourhrEMA21 < fourhrEMA34 and fourhrEMA34 < fourhrEMA55 and fourhrEMA55 < fourhrEMA89;
def fourhrSPW = fourhrEMA8 < fourhrEMA21 and fourhrEMA34 > fourhrEMA55 and fourhrEMA55 > fourhrEMA89;
def fourhrSNW = fourhrEMA8 > fourhrEMA21 and fourhrEMA34 < fourhrEMA55 and fourhrEMA55 < fourhrEMA89;
AddLabel(yes, "4HR", if fourhrSP then GlobalColor("StackedPositive") else if fourhrSN then GlobalColor("StackedNegative") else if (fourhrSPW or fourhrSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## day aggregationPeriod variables
input dayaggregationPeriod = AggregationPeriod.DAY;
def dayprice = close(period = AggregationPeriod.DAY);
def dayEMA89 = ExpAverage(close, 89);
def dayEMA55 = ExpAverage(close, 55);
def dayEMA34 = ExpAverage(close, 34);
def dayEMA21 = ExpAverage(close, 21);
def dayEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def daySP = dayEMA8 > dayEMA21 and dayEMA21 > dayEMA34 and dayEMA34 > dayEMA55 and dayEMA55 > dayEMA89;
def daySN = dayEMA8 < dayEMA21 and dayEMA21 < dayEMA34 and dayEMA34 < dayEMA55 and dayEMA55 < dayEMA89;
def daySPW = dayEMA8 < dayEMA21 and dayEMA34 > dayEMA55 and dayEMA55 > dayEMA89;
def daySNW = dayEMA8 > dayEMA21 and dayEMA21 < dayEMA55 and dayEMA55 < dayEMA89;
AddLabel(yes, "DAY", if daySP then GlobalColor("StackedPositive") else if daySN then GlobalColor("StackedNegative") else if (daySPW or daySNW) then GlobalColor("Warning") else GlobalColor("Neutral"));
## week aggregationPeriod variables
input weekaggregationPeriod = AggregationPeriod.WEEK;
def weekprice = close(period = AggregationPeriod.WEEK);
def weekEMA89 = ExpAverage(close, 89);
def weekEMA55 = ExpAverage(close, 55);
def weekEMA34 = ExpAverage(close, 34);
def weekEMA21 = ExpAverage(close, 21);
def weekEMA8 = ExpAverage(close, 8);
DefineGlobalColor("StackedPositive", Color.GREEN);
DefineGlobalColor("StackedNegative", Color.RED);
DefineGlobalColor("Warning", Color.YELLOW);
DefineGlobalColor("Neutral", Color.GRAY);
def weekSP = weekEMA8 > weekEMA21 and weekEMA21 > weekEMA34 and weekEMA34 > weekEMA55 and weekEMA55 > weekEMA89;
def weekSN = weekEMA8 < weekEMA21 and weekEMA21 < weekEMA34 and weekEMA34 < weekEMA55 and weekEMA55 < weekEMA89;
def weekSPW = weekEMA8 < weekEMA21 and weekEMA34 > weekEMA55 and weekEMA55 > weekEMA89;
def weekSNW = weekEMA8 > weekEMA21 and weekEMA34 < weekEMA55 and weekEMA55 < weekEMA89;
AddLabel(yes, "WK", if WEEKSP then GlobalColor("StackedPositive") else if weekSN then GlobalColor("StackedNegative") else if (weekSPW or weekSNW) then GlobalColor("Warning") else GlobalColor("Neutral"));