```
declare lower;
input shortLength = 6;
input longLength = 14;
input lowerSideWinderLimit = 30.0;
input upperSideWinderLimit = 100.0;
input hideSideWinder = No;
def LinearReg = Inertia(close, 25);
def expAvg = ExpAverage(close, 34);
def diff = close - expAvg;
def yyyyMmDd = getYyyyMmDd();
def session_duration_minutes = (regularTradingEnd(yyyyMmDd) - regularTradingStart(yyyyMmDd)) / AggregationPeriod.MIN;
def interval_size_raw;
def aggregation = getAggregationPeriod();
if (aggregation == AggregationPeriod.DAY) {
interval_size_raw = session_duration_minutes * 60;
} else if (aggregation == AggregationPeriod.TWO_DAYS) {
interval_size_raw = session_duration_minutes * 60 * 2;
} else if (aggregation == AggregationPeriod.THREE_DAYS) {
interval_size_raw = session_duration_minutes * 60 * 3;
} else if (aggregation == AggregationPeriod.FOUR_DAYS) {
interval_size_raw = session_duration_minutes * 60 * 4;
} else if (aggregation == AggregationPeriod.WEEK) {
interval_size_raw = session_duration_minutes * 60 * 5;
} else if (aggregation == AggregationPeriod.MONTH or aggregation == AggregationPeriod.OPT_EXP) {
interval_size_raw = session_duration_minutes * 60 * 22;
} else if (aggregation >= AggregationPeriod.MIN) {
interval_size_raw = aggregation / AggregationPeriod.MIN;
} else {
interval_size_raw = aggregation;
}
def ema_angle_factor = Sqrt(interval_size_raw / 180);
def avg_ema = (expAvg[2] + expAvg[1]) / 2;
def avg_lsma = (LinearReg[2] + LinearReg[1]) / 2;
def lsma_slope = (LinearReg - avg_lsma) / tickSize();
def lsma_angle = ATan(lsma_slope / ema_angle_factor) / Double.Pi * 180;
def ema_slope = (expAvg - avg_ema) / tickSize();
def ema_angle = ATan(ema_slope / ema_angle_factor) / Double.Pi * 180;
def sw = lsma_angle + ema_angle;
def swabs = AbsValue(sw);
plot CCI = cci(length = longLength);
plot "CCI Hist" = CCI;
plot "SW +200" = if IsNaN(close) then Double.NaN else 200;
plot "SW -200" = if IsNaN(close) then Double.NaN else -200;
plot ZeroLine = if IsNaN(close) then Double.NaN else 0;
CCI.SetDefaultColor(GetColor(1));
CCI.SetLineWeight(1);
"SW +200".SetDefaultColor(GetColor(1));
"SW +200".SetLineWeight(2);
"SW +200".SetPaintingStrategy(PaintingStrategy.DASHES);
"SW +200".HideTitle();
"SW +200".HideBubble();
"SW +200".DefineColor("Trending", Color.GREEN);
"SW +200".DefineColor("Normal", Color.YELLOW);
"SW +200".DefineColor("Flat", Color.RED);
"SW +200".AssignValueColor(
if swabs >= upperSideWinderLimit then "SW +200".color("Trending")
else if swabs > lowerSideWinderLimit then "SW +200".color("Normal")
else "SW +200".color("Flat"));
"SW -200".AssignValueColor("SW +200".TakeValueColor());
"SW -200".SetDefaultColor(GetColor(1));
"SW -200".SetLineWeight(2);
"SW -200".SetPaintingStrategy(PaintingStrategy.DASHES);
"SW -200".HideTitle();
"SW -200".HideBubble();
ZeroLine.SetDefaultColor(GetColor(9));
ZeroLine.SetPaintingStrategy(PaintingStrategy.DASHES);
ZeroLine.SetLineWeight(1);
ZeroLine.HideTitle();
AddLabel (yes,if close then " CCI " else "", Color.CYAN);
#Label Rise and Fall-------------------------------------------------------------------------------------
input n = 1;
def VUP = CCI > CCI[n];
def VDN = CCI < CCI[n];
AddLabel(1, " CCI : " + Round(CCI, 1) + (if VUP then " RISING " + "" else if VDN then " FALLING " + "" else " --NEUTRAL"),
if VUP then Color.green else if VDN then color.RED else Color.YELLOW);
#end CCI-----------------------------
input Show30DayAvg = yes;
input ShowTodayVolume = yes;
input ShowPercentOf30DayAvg = yes;
input UnusualVolumePercent = 200;
input Show30BarAvg = yes;
input ShowCurrentBar = yes;
input ShowPercentOf30BarAvg = yes;
input ShowSellVolumePercent = yes;
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def buying = V*(C-L)/(H-L);
def selling = V*(H-C)/(H-L);
#Volume Data
def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30;
def today = volume(period = "DAY");
def percentOf30Day = Round((today / volLast30DayAvg) * 100, 0);
def avg30Bars = (volume[1] + volume[2] + volume[3] + volume[4] + volume[5] + volume[6] + volume[7] + volume[8] + volume[9] + volume[10] + volume[11] + volume[12] + volume[13] + volume[14] + volume[15] + volume[16] + volume[17] + volume[18] + volume[19] + volume[20] + volume[21] + volume[22] + volume[23] + volume[24] + volume[25] + volume[26] + volume[27] + volume[28] + volume[29] + volume[30]) / 30;
def curVolume = volume;
def percentOf30Bar = Round((curVolume / avg30Bars) * 100, 0);
def SellVolPercent = Round((Selling / Volume) * 100, 0);
# Labels-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AddLabel (yes,if close then " V " else "", Color.CYAN);
AddLabel(ShowSellVolumePercent, " Volume %: " + SellVolPercent, (if SellVolPercent >= 51 then Color.RED else if SellVolPercent < 49 then Color.GREEN else Color.GREEN));
#Branch Moving Averages Label ---------------------------------------------------------------------------
#MOVING AVERAGES-----------------------------------------------------------------
input length2 = 2;
input length5 = 5;
input length8 = 8;
input length10 = 10;
input length13 = 13;
input length21 = 21;
input length35 = 35;
input length50 = 50;
input length100 = 100;
input length200 = 200;
input over_Bought = 80;
input over_Sold = 20;
input price = close;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = no;
input averageType1 = AverageType.SIMPLE;
input crossingType = {default above, below};
def NetChgAvg = MovingAverage(averageType, price - price[1], length10);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length10);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def avg2 = MovingAverage(averageType1, price, length2);
def avg5 = MovingAverage(averageType1, price, length5);
def avg8 = MovingAverage(averageType1, price, length8);
def avg10 = MovingAverage(averageType1, price, length10);
def avg13 = MovingAverage(averageType1, price, length13);
def avg21 = MovingAverage(averageType1, price, length21);
def avg35 = MovingAverage(averageType1, price, length35);
def avg50 = MovingAverage(averageType1, price, length50);
def avg100 = MovingAverage(averageType1, price, length100);
def avg200 = MovingAverage(averageType1, price, length200);
#MOVING AVERGERS LABELS-----------------------------------------------------------------------------------
AddLabel (yes, if close then " MA " else "", Color.CYAN);
AddLabel(yes, if close < avg2 then " (2) " + Average (close, 2) else "", Color.RED);
AddLabel (yes, if close > avg2 then " (2) " + Average (close, 2) else "", Color.GREEN);
AddLabel(yes, if close < avg5 then " (5) " + Average (close, 5) else "", Color.RED);
AddLabel (yes, if close > avg5 then " (5) " + Average (close, 5) else "", Color.GREEN);
AddLabel(yes, if close < avg8 then " (8) " + Average (close, 8) else "", Color.RED);
AddLabel (yes, if close > avg8 then " (8) " + Average (close, 8) else "", Color.GREEN);
AddLabel(yes, if close < avg10 then " (10) " + Average (close, 10) else "", Color.RED);
AddLabel (yes, if close > avg10 then " (10) " + Average (close, 10) else "", Color.GREEN);
AddLabel(yes, if close < avg13 then " (13) " + Average (close, 13) else "", Color.RED);
AddLabel (yes, if close > avg13 then " (13) " + Average (close, 13) else "", Color.GREEN);
AddLabel (yes, if close < avg21 then " (21) " + Average (close, 21) else "", Color.RED);
AddLabel (yes, if close > avg21 then " (21) " + Average (close, 21) else "", Color.GREEN);
AddLabel (yes, if close < avg35 then " (35) " + Average (close, 35) else "", Color.RED);
AddLabel (yes, if close > avg35 then " (35) " + Average (close, 35) else "", Color.GREEN);
AddLabel (yes, if close < avg50 then " (50) " + Average (close, 50) else "", Color.RED);
AddLabel (yes, if close > avg50 then " (50) " + Average (close, 50) else "", Color.GREEN);
AddLabel (yes, if close < avg100 then " (100) " + Average (close, 100) else "", Color.RED);
AddLabel (yes, if close > avg100 then " (100) " + Average (close, 100) else "", Color.GREEN);
AddLabel (yes, if close < avg200 then " (200) " + Average (close, 200) else "", Color.RED);
AddLabel (yes, if close > avg200 then " (200) " + Average (close, 200) else "", Color.GREEN);
#THE END------------------------------------------------------------------------------------------------------------
```