###########################################
Declare Lower;
# GLOBAL DEFINITIONS
DefineGlobalColor("TrendUp", CreateColor(0, 254, 30));
DefineGlobalColor("TrendDown", CreateColor(255, 3, 2));
input agg = AggregationPeriod.FIVE_MIN;
input agg2 = AggregationPeriod.THIRTY_MIN;
input agg3 = AggregationPeriod.HOUR;
input agg4 = AggregationPeriod.TWO_Hours;;
input agg5 = AggregationPeriod.FOUR_HOURs;
input agg6 = AggregationPeriod.DAY;
Input Len1 = 6;
Input Len2 = 9;
Input Len3 = 12;
Input Len4 = 15;
Input Len5 = 18;
input DotSize = 5;
input n = 30;
def n1 = n + 1;
def C = Close(Period =AGG);
def H = High(Period = AGG);
def L = Low(Period = AGG);
def C2 = Close(Period =AGG2);
def H2 = High(Period = AGG2);
def L2 = Low(Period = AGG2);
def C3 = Close(Period =AGG3);
def H3 = High(Period = AGG3);
def L3 = Low(Period = AGG3);
def C4 = Close(Period =AGG4);
def H4 = High(Period = AGG4);
def L4 = Low(Period = AGG4);
def C5 = Close(Period =AGG5);
def H5 = High(Period = AGG5);
def L5 = Low(Period = AGG5);
def C6= Close(Period =AGG6);
def H6 = High(Period = AGG6);
def L6 = Low(Period = AGG6);
#Aggregation 1
#lA1BL6
def A1BL6smaHigh = simpleMovingAvg(H, Len1);
def A1BL6smaLow = simpleMovingAvg(L, Len1);
def A1BL6Hlv = if C > A1BL6smaHigh then 1 else if C< A1BL6smaLow then -1 else A1BL6Hlv[1];
def A1BL6sslDown = if A1BL6Hlv< 0 then A1BL6smaHigh else A1BL6smaLow;
def A1BL6sslUp = if A1BL6Hlv< 0 then A1BL6smaLow else A1BL6smaHigh;
plot A1BL6_Dot = if IsNaN(c) then Double.NaN else 1;
A1BL6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A1BL6_Dot.SetLineWeight(DotSize);
A1BL6_Dot.AssignValueColor(if A1BL6sslUP < A1BL6sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 2
#A2BL6
def A2BL6smaHigh = simpleMovingAvg(H2, 6);
def A2BL6smaLow = simpleMovingAvg(L2, 6);
def A2BL6Hlv = if C2 > A2BL6smaHigh then 1 else if C2< A2BL6smaLow then -1 else A2BL6Hlv[1];
def A2BL6sslDown = if A2BL6Hlv< 0 then A2BL6smaHigh else A2BL6smaLow;
def A2BL6sslUp = if A2BL6Hlv< 0 then A2BL6smaLow else A2BL6smaHigh;
plot A2BL6_Dot = if IsNaN(c2) then Double.NaN else 2;
A2BL6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A2BL6_Dot.SetLineWeight(DotSize);
A2BL6_Dot.AssignValueColor(if A2BL6sslUP < A2BL6sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 3
#A3BL6
def A3BL6smaHigh = simpleMovingAvg(H3, Len1);
def A3BL6smaLow = simpleMovingAvg(L3, Len1);
def A3BL6Hlv = if C3 > A3BL6smaHigh then 1 else if C3 < A3BL6smaLow then -1 else A3BL6Hlv[1];
def A3BL6sslDown = if A3BL6Hlv < 0 then A3BL6smaHigh else A3BL6smaLow;
def A3BL6sslUp = if A3BL6Hlv < 0 then A3BL6smaLow else A3BL6smaHigh;
plot A3BL6_Dot = if IsNaN(c3) then Double.NaN else 3;
A3BL6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A3BL6_Dot.SetLineWeight(DotSize);
A3BL6_Dot.AssignValueColor(if A3BL6sslUP < A3BL6sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 4
#A4BL6
def A4BL6smaHigh = simpleMovingAvg(H4, Len1);
def A4BL6smaLow = simpleMovingAvg(L4, Len1);
def A4BL6Hlv = if C4 > A4BL6smaHigh then 1 else if C4 < A4BL6smaLow then -1 else A4BL6Hlv[1];
def A4BL6sslDown = if A4BL6Hlv < 0 then A4BL6smaHigh else A4BL6smaLow;
def A4BL6sslUp = if A4BL6Hlv < 0 then A4BL6smaLow else A4BL6smaHigh;
plot A4BL6_Dot = if IsNaN(c4) then Double.NaN else 4;
A4BL6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A4BL6_Dot.SetLineWeight(DotSize);
A4BL6_Dot.AssignValueColor(if A4BL6sslUP < A4BL6sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 5
#A5BL6
def A5BL6smaHigh = simpleMovingAvg(H5, Len1);
def A5BL6smaLow = simpleMovingAvg(L5, Len1);
def A5BL6Hlv = if C5 > A5BL6smaHigh then 1 else if C5 < A5BL6smaLow then -1 else A5BL6Hlv[1];
def A5BL6sslDown = if A5BL6Hlv < 0 then A5BL6smaHigh else A5BL6smaLow;
def A5BL6sslUp = if A5BL6Hlv < 0 then A5BL6smaLow else A5BL6smaHigh;
plot A5BL6_Dot = if IsNaN(c5) then Double.NaN else 5;
A5BL6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A5BL6_Dot.SetLineWeight(DotSize);
A5BL6_Dot.AssignValueColor(if A5BL6sslUP < A5BL6sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 6
#A6BL6
def A6BL6smaHigh = simpleMovingAvg(H6, Len1);
def A6BL6smaLow = simpleMovingAvg(L6, Len1);
def A6BL6Hlv = if C6 > A6BL6smaHigh then 1 else if C6 < A6BL6smaLow then -1 else A6BL6Hlv[1];
def A6BL6sslDown = if A6BL6Hlv < 0 then A6BL6smaHigh else A6BL6smaLow;
def A6BL6sslUp = if A6BL6Hlv < 0 then A6BL6smaLow else A6BL6smaHigh;
plot A6BL6_Dot = if IsNaN(c6) then Double.NaN else 6;
A6BL6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A6BL6_Dot.SetLineWeight(DotSize);
A6BL6_Dot.AssignValueColor(if A6BL6sslUP < A6BL6sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 1
#A1BL9
def A1BL9smaHigh = simpleMovingAvg(H, Len2);
def A1BL9smaLow = simpleMovingAvg(L, Len2);
def A1BL9Hlv = if C > A1BL9smaHigh then 1 else if C< A1BL9smaLow then -1 else A1BL9Hlv[1];
def A1BL9sslDown = if A1BL9Hlv< 0 then A1BL9smaHigh else A1BL9smaLow;
def A1BL9sslUp = if A1BL9Hlv< 0 then A1BL9smaLow else A1BL9smaHigh;
plot A1BL9_Dot = if IsNaN(c) then Double.NaN else 7;
A1BL9_Dot.SetPaintingStrategy(PaintingStrategy.Points);
A1BL9_Dot.SetLineWeight(DotSize);
A1BL9_Dot.AssignValueColor(if A1BL9sslUP < A1BL9sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 2
#A2BL9
def A2BL9smaHigh = simpleMovingAvg(H2, Len2);
def A2BL9smaLow = simpleMovingAvg(L2, Len2);
def A2BL9Hlv = if C2 > A2BL9smaHigh then 1 else if C2< A2BL9smaLow then -1 else A2BL9Hlv[1];
def A2BL9sslDown = if A2BL9Hlv< 0 then A2BL9smaHigh else A2BL9smaLow;
def A2BL9sslUp = if A2BL9Hlv< 0 then A2BL9smaLow else A2BL9smaHigh;
plot A2BL9_Dot = if IsNaN(c2) then Double.NaN else 8;
A2BL9_Dot.SetPaintingStrategy(PaintingStrategy.Points);
A2BL9_Dot.SetLineWeight(DotSize);
A2BL9_Dot.AssignValueColor(if A2BL9sslUP < A2BL9sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 3
#A3BL9
def A3BL9smaHigh = simpleMovingAvg(H3, Len2);
def A3BL9smaLow = simpleMovingAvg(L3, Len2);
def A3BL9Hlv = if C3 > A3BL9smaHigh then 1 else if C3 < A3BL9smaLow then -1 else A3BL9Hlv[1];
def A3BL9sslDown = if A3BL9Hlv < 0 then A3BL9smaHigh else A3BL9smaLow;
def A3BL9sslUp = if A3BL9Hlv < 0 then A3BL9smaLow else A3BL9smaHigh;
plot A3BL9_Dot = if IsNaN(c3) then Double.NaN else 9;
A3BL9_Dot.SetPaintingStrategy(PaintingStrategy.points);
A3BL9_Dot.SetLineWeight(DotSize);
A3BL9_Dot.AssignValueColor(if A3BL9sslUP < A3BL9sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 4
#A4BL9
def A4BL9smaHigh = simpleMovingAvg(H4, Len2);
def A4BL9smaLow = simpleMovingAvg(L4, Len2);
def A4BL9Hlv = if C4 > A4BL9smaHigh then 1 else if C4 < A4BL9smaLow then -1 else A4BL9Hlv[1];
def A4BL9sslDown = if A4BL9Hlv < 0 then A4BL9smaHigh else A4BL9smaLow;
def A4BL9sslUp = if A4BL9Hlv < 0 then A4BL9smaLow else A4BL9smaHigh;
plot A4BL9_Dot = if IsNaN(c4) then Double.NaN else 10;
A4BL9_Dot.SetPaintingStrategy(PaintingStrategy.points);
A4BL9_Dot.SetLineWeight(DotSize);
A4BL9_Dot.AssignValueColor(if A4BL9sslUP < A4BL9sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 5
#lA5BL9
def A5BL9smaHigh = simpleMovingAvg(H5, Len2);
def A5BL9smaLow = simpleMovingAvg(L5, Len2);
def A5BL9Hlv = if C5 > A5BL9smaHigh then 1 else if C5 < A5BL9smaLow then -1 else A5BL9Hlv[1];
def A5BL9sslDown = if A5BL9Hlv < 0 then A5BL9smaHigh else A5BL9smaLow;
def A5BL9sslUp = if A5BL9Hlv < 0 then A5BL9smaLow else A5BL9smaHigh;
plot A5BL9_Dot = if IsNaN(c5) then Double.NaN else 11;
A5BL9_Dot.SetPaintingStrategy(PaintingStrategy.Points);
A5BL9_Dot.SetLineWeight(DotSize);
A5BL9_Dot.AssignValueColor(if A5BL9sslUP < A5BL9sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 6
#A6BL9
def A6BL9smaHigh = simpleMovingAvg(H6, Len2);
def A6BL9smaLow = simpleMovingAvg(L6, Len2);
def A6BL9Hlv = if C6 > A6BL9smaHigh then 1 else if C6 < A6BL9smaLow then -1 else A6BL9Hlv[1];
def A6BL9sslDown = if A6BL9Hlv < 0 then A6BL9smaHigh else A6BL9smaLow;
def A6BL9sslUp = if A6BL9Hlv < 0 then A6BL9smaLow else A6BL9smaHigh;
plot A6BL9_Dot = if IsNaN(c6) then Double.NaN else 12;
A6BL9_Dot.SetPaintingStrategy(PaintingStrategy.Points);
A6BL9_Dot.SetLineWeight(DotSize);
A6BL9_Dot.AssignValueColor(if A6BL9sslUP < A6BL9sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 1
#A1BL12
def A1BL12smaHigh = simpleMovingAvg(H, Len3);
def A1BL12smaLow = simpleMovingAvg(L, Len3);
def A1BL12Hlv = if C > A1BL12smaHigh then 1 else if C< A1BL12smaLow then -1 else A1BL12Hlv[1];
def A1BL12sslDown = if A1BL12Hlv< 0 then A1BL12smaHigh else A1BL12smaLow;
def A1BL12sslUp = if A1BL12Hlv< 0 then A1BL12smaLow else A1BL12smaHigh;
plot A1BL12_Dot = if IsNaN(c) then Double.NaN else 13;
A1BL12_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A1BL12_Dot.SetLineWeight(DotSize);
A1BL12_Dot.AssignValueColor(if A1BL12sslUP < A1BL12sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 2
#A2BL12
def A2BL12smaHigh = simpleMovingAvg(H2, Len3);
def A2BL12smaLow = simpleMovingAvg(L2, len3);
def A2BL12Hlv = if C2 > A2BL12smaHigh then 1 else if C2< A2BL12smaLow then -1 else A2BL12Hlv[1];
def A2BL12sslDown = if A2BL12Hlv< 0 then A2BL12smaHigh else A2BL12smaLow;
def A2BL12sslUp = if A2BL12Hlv< 0 then A2BL12smaLow else A2BL12smaHigh;
plot A2BL12_Dot = if IsNaN(c2) then Double.NaN else 14;
A2BL12_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A2BL12_Dot.SetLineWeight(DotSize);
A2BL12_Dot.AssignValueColor(if A2BL12sslUP < A2BL12sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 3
#A3BL12
def A3BL12smaHigh = simpleMovingAvg(H3, Len3);
def A3BL12smaLow = simpleMovingAvg(L3, Len3);
def A3BL12Hlv = if C3 > A3BL12smaHigh then 1 else if C3 < A3BL12smaLow then -1 else A3BL12Hlv[1];
def A3BL12sslDown = if A3BL12Hlv < 0 then A3BL12smaHigh else A3BL12smaLow;
def A3BL12sslUp = if A3BL12Hlv < 0 then A3BL12smaLow else A3BL12smaHigh;
plot A3BL12_Dot = if IsNaN(c3) then Double.NaN else 15;
A3BL12_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A3BL12_Dot.SetLineWeight(DotSize);
A3BL12_Dot.AssignValueColor(if A3BL12sslUP < A3BL12sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 4
#A4BL12
def A4BL12smaHigh = simpleMovingAvg(H4, Len3);
def A4BL12smaLow = simpleMovingAvg(L4, Len3);
def A4BL12Hlv = if C4 > A4BL12smaHigh then 1 else if C4 < A4BL12smaLow then -1 else A4BL12Hlv[1];
def A4BL12sslDown = if A4BL12Hlv < 0 then A4BL12smaHigh else A4BL12smaLow;
def A4BL12sslUp = if A4BL12Hlv < 0 then A4BL12smaLow else A4BL12smaHigh;
plot A4BL12_Dot = if IsNaN(c4) then Double.NaN else 16;
A4BL12_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A4BL12_Dot.SetLineWeight(DotSize);
A4BL12_Dot.AssignValueColor(if A4BL12sslUP < A4BL12sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 5
#A5BL12
def A5BL12smaHigh = simpleMovingAvg(H5, Len3);
def A5BL12smaLow = simpleMovingAvg(L5, Len3);
def A5BL12Hlv = if C5 > A5BL12smaHigh then 1 else if C5 < A5BL12smaLow then -1 else A5BL12Hlv[1];
def A5BL12sslDown = if A5BL12Hlv < 0 then A5BL12smaHigh else A5BL12smaLow;
def A5BL12sslUp = if A5BL12Hlv < 0 then A5BL12smaLow else A5BL12smaHigh;
plot A5BL12_Dot = if IsNaN(c5) then Double.NaN else 17;
A5BL12_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A5BL12_Dot.SetLineWeight(DotSize);
A5BL12_Dot.AssignValueColor(if A5BL12sslUP < A5BL12sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 6
#A6BL12
def A6BL12smaHigh = simpleMovingAvg(H6, Len3);
def A6BL12smaLow = simpleMovingAvg(L6, Len3);
def A6BL12Hlv = if C6 > A6BL12smaHigh then 1 else if C6 < A6BL12smaLow then -1 else A6BL12Hlv[1];
def A6BL12sslDown = if A6BL12Hlv < 0 then A6BL12smaHigh else A6BL12smaLow;
def A6BL12sslUp = if A6BL12Hlv < 0 then A6BL12smaLow else A6BL12smaHigh;
plot A6BL12_Dot = if IsNaN(c6) then Double.NaN else 18;
A6BL12_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A6BL12_Dot.SetLineWeight(DotSize);
A6BL12_Dot.AssignValueColor(if A6BL12sslUP < A6BL12sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 1
#A1BL15
def A1BL15smaHigh = simpleMovingAvg(H, Len4);
def A1BL15smaLow = simpleMovingAvg(L, Len4);
def A1BL15Hlv = if C > A1BL15smaHigh then 1 else if C< A1BL15smaLow then -1 else A1BL15Hlv[1];
def A1BL15sslDown = if A1BL15Hlv< 0 then A1BL15smaHigh else A1BL15smaLow;
def A1BL15sslUp = if A1BL15Hlv< 0 then A1BL15smaLow else A1BL15smaHigh;
plot A1BL15_Dot = if IsNaN(c) then Double.NaN else 19;
A1BL15_Dot.SetPaintingStrategy(PaintingStrategy.points);
A1BL15_Dot.SetLineWeight(DotSize);
A1BL15_Dot.AssignValueColor(if A1BL15sslUP < A1BL15sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 2
# A2BL15
def A2BL15smaHigh = simpleMovingAvg(H2, Len4);
def A2BL15smaLow = simpleMovingAvg(L2, Len4);
def A2BL15Hlv = if C2 > A2BL15smaHigh then 1 else if C2< A2BL15smaLow then -1 else A2BL15Hlv[1];
def A2BL15sslDown = if A2BL15Hlv< 0 then A2BL15smaHigh else A2BL15smaLow;
def A2BL15sslUp = if A2BL15Hlv< 0 then A2BL15smaLow else A2BL15smaHigh;
plot A2BL15_Dot = if IsNaN(c2) then Double.NaN else 20;
A2BL15_Dot.SetPaintingStrategy(PaintingStrategy.points);
A2BL15_Dot.SetLineWeight(DotSize);
A2BL15_Dot.AssignValueColor(if A2BL15sslUP < A2BL15sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 3
#A3BL15
def A3BL15smaHigh = simpleMovingAvg(H3, Len4);
def A3BL15smaLow = simpleMovingAvg(L3, Len4);
def A3BL15Hlv = if C3 > A3BL15smaHigh then 1 else if C3 < A3BL15smaLow then -1 else A3BL15Hlv[1];
def A3BL15sslDown = if A3BL15Hlv < 0 then A3BL15smaHigh else A3BL15smaLow;
def A3BL15sslUp = if A3BL15Hlv < 0 then A3BL15smaLow else A3BL15smaHigh;
plot A3BL15_Dot = if IsNaN(c3) then Double.NaN else 21;
A3BL15_Dot.SetPaintingStrategy(PaintingStrategy.points);
A3BL15_Dot.SetLineWeight(DotSize);
A3BL15_Dot.AssignValueColor(if A3BL15sslUP < A3BL15sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 4
#A4BL15
def A4BL15smaHigh = simpleMovingAvg(H4, 15);
def A4BL15smaLow = simpleMovingAvg(L4, 15);
def A4BL15Hlv = if C4 > A4BL15smaHigh then 1 else if C4 < A4BL15smaLow then -1 else A4BL15Hlv[1];
def A4BL15sslDown = if A4BL15Hlv < 0 then A4BL15smaHigh else A4BL15smaLow;
def A4BL15sslUp = if A4BL15Hlv < 0 then A4BL15smaLow else A4BL15smaHigh;
plot A4BL15_Dot = if IsNaN(c4) then Double.NaN else 22;
A4BL15_Dot.SetPaintingStrategy(PaintingStrategy.points);
A4BL15_Dot.SetLineWeight(DotSize);
A4BL15_Dot.AssignValueColor(if A4BL15sslUP < A4BL15sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 5
#A5BL15
def A5BL15smaHigh = simpleMovingAvg(H5, 15);
def A5BL15smaLow = simpleMovingAvg(L5, 15);
def A5BL15Hlv = if C5 > A5BL15smaHigh then 1 else if C5 < A5BL15smaLow then -1 else A5BL15Hlv[1];
def A5BL15sslDown = if A5BL15Hlv < 0 then A5BL15smaHigh else A5BL15smaLow;
def A5BL15sslUp = if A5BL15Hlv < 0 then A5BL15smaLow else A5BL15smaHigh;
plot A5BL15_Dot = if IsNaN(c5) then Double.NaN else 23;
A5BL15_Dot.SetPaintingStrategy(PaintingStrategy.points);
A5BL15_Dot.SetLineWeight(DotSize);
A5BL15_Dot.AssignValueColor(if A5BL15sslUP < A5BL15sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 6
#A6BL15
def A6BL15smaHigh = simpleMovingAvg(H6, Len4);
def A6BL15smaLow = simpleMovingAvg(L6, Len4);
def A6BL15Hlv = if C6 > A6BL15smaHigh then 1 else if C6 < A6BL15smaLow then -1 else A6BL15Hlv[1];
def A6BL15sslDown = if A6BL15Hlv < 0 then A6BL15smaHigh else A6BL15smaLow;
def A6BL15sslUp = if A6BL15Hlv < 0 then A6BL15smaLow else A6BL15smaHigh;
plot A6BL15_Dot = if IsNaN(c6) then Double.NaN else 24;
A6BL15_Dot.SetPaintingStrategy(PaintingStrategy.points);
A6BL15_Dot.SetLineWeight(DotSize);
A6BL15_Dot.AssignValueColor(if A6BL15sslUP < A6BL15sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 1
#A1BL18
def A1BL18smaHigh = simpleMovingAvg(H, Len5);
def A1BL18smaLow = simpleMovingAvg(L, Len5);
def A1BL18Hlv = if C > A1BL18smaHigh then 1 else if C< A1BL18smaLow then -1 else A1BL18Hlv[1];
def A1BL18sslDown = if A1BL18Hlv< 0 then A1BL18smaHigh else A1BL18smaLow;
def A1BL18sslUp = if A1BL18Hlv< 0 then A1BL18smaLow else A1BL18smaHigh;
plot A1BL18_Dot = if IsNaN(c) then Double.NaN else 25;
A1BL18_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A1BL18_Dot.SetLineWeight(DotSize);
A1BL18_Dot.AssignValueColor(if A1BL18sslUP < A1BL18sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 2
#A2BL18
def A2BL18smaHigh = simpleMovingAvg(H2, Len5);
def A2BL18smaLow = simpleMovingAvg(L2, Len5);
def A2BL18Hlv = if C2 > A2BL18smaHigh then 1 else if C2< A2BL18smaLow then -1 else A2BL18Hlv[1];
def A2BL18sslDown = if A2BL18Hlv< 0 then A2BL18smaHigh else A2BL18smaLow;
def A2BL18sslUp = if A2BL18Hlv< 0 then A2BL18smaLow else A2BL18smaHigh;
plot A2BL18_Dot = if IsNaN(c2) then Double.NaN else 26;
A2BL18_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A2BL18_Dot.SetLineWeight(DotSize);
A2BL18_Dot.AssignValueColor(if A2BL18sslUP < A2BL18sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 3
#A3BL18
def A3BL18smaHigh = simpleMovingAvg(H3, 18);
def A3BL18smaLow = simpleMovingAvg(L3, 18);
def A3BL18Hlv = if C3 > A3BL18smaHigh then 1 else if C3 < A3BL18smaLow then -1 else A3BL18Hlv[1];
def A3BL18sslDown = if A3BL18Hlv < 0 then A3BL18smaHigh else A3BL18smaLow;
def A3BL18sslUp = if A3BL18Hlv < 0 then A3BL18smaLow else A3BL18smaHigh;
plot A3BL18_Dot = if IsNaN(c3) then Double.NaN else 27;
A3BL18_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A3BL18_Dot.SetLineWeight(DotSize);
A3BL18_Dot.AssignValueColor(if A3BL18sslUP < A3BL18sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 4
#A4BL18
def A4BL18smaHigh = simpleMovingAvg(H4, Len5);
def A4BL18smaLow = simpleMovingAvg(L4, Len5);
def A4BL18Hlv = if C4 > A4BL18smaHigh then 1 else if C4 < A4BL18smaLow then -1 else A4BL18Hlv[1];
def A4BL18sslDown = if A4BL18Hlv < 0 then A4BL18smaHigh else A4BL18smaLow;
def A4BL18sslUp = if A4BL18Hlv < 0 then A4BL18smaLow else A4BL18smaHigh;
plot A4BL18_Dot = if IsNaN(c4) then Double.NaN else 28;
A4BL18_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A4BL18_Dot.SetLineWeight(DotSize);
A4BL18_Dot.AssignValueColor(if A4BL18sslUP < A4BL18sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 5
#A5BL18
def A5BL18smaHigh = simpleMovingAvg(H5, Len5);
def A5BL18smaLow = simpleMovingAvg(L5, Len5);
def A5BL18Hlv = if C5 > A5BL18smaHigh then 1 else if C5 < A5BL18smaLow then -1 else A5BL18Hlv[1];
def A5BL18sslDown = if A5BL18Hlv < 0 then A5BL18smaHigh else A5BL18smaLow;
def A5BL18sslUp = if A5BL18Hlv < 0 then A5BL18smaLow else A5BL18smaHigh;
plot A5BL18_Dot = if IsNaN(c5) then Double.NaN else 29;
A5BL18_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A5BL18_Dot.SetLineWeight(DotSize);
A5BL18_Dot.AssignValueColor(if A5BL18sslUP < A5BL18sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
#Aggregation 6
#A6BL18
def A6BL18smaHigh = simpleMovingAvg(H6, Len5);
def A6BL18smaLow = simpleMovingAvg(L6, Len5);
def A6BL18Hlv = if C6 > A6BL18smaHigh then 1 else if C6 < A6BL18smaLow then -1 else A6BL18Hlv[1];
def A6BL18sslDown = if A6BL18Hlv < 0 then A6BL18smaHigh else A6BL18smaLow;
def A6BL18sslUp = if A6BL18Hlv < 0 then A6BL18smaLow else A6BL18smaHigh;
plot A6BL18_Dot = if IsNaN(c6) then Double.NaN else 30;
A6BL18_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A6BL18_Dot.SetLineWeight(DotSize);
A6BL18_Dot.AssignValueColor(if A6BL18sslUP < A6BL18sslDown then GlobalColor("TrendDown") else GlobalColor("TrendUp"));