Индикатор для Thinkorswim "Fusion" TTM_Squeeze с MACD все в одной гистограмме

Код:
declare lower;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input AverageType = {SMA, default EMA};
input val = 4;
input nval = -4;
plot Value;
plot Avg;
switch (AverageType) {
case SMA:
Value = Average(close, fastLength) - Average(close, slowLength);
Avg = Average(Value, MACDLength);
case EMA:
Value = ExpAverage(close, fastLength) - ExpAverage(close, slowLength);
Avg = ExpAverage(Value, MACDLength);
}
plot Diff = Value - Avg;
plot ZeroLine = 0;
def CROSSING = if Diff >= -0.05 and Diff = -0.05 and Diff Avg then 1 else 0;
assignpricecolor(if Value > Avg then color.BLUE else color.current);
def BEARISH = if Avg > Value then 1 else 0;
assignpricecolor(if BEARISH == 1 then color.MAGENTA else color.current);
def DIVRGNCE = if Diff > val or Diff < nval then 1 else 0;
#assignpricecolor(if ON == 1 then color.YELLOW else color.current);
Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.Color("Positive and Up") else Diff.Color("Positive and Down") else if Diff < Diff[1] then Diff.Color("Negative and Down") else Diff.Color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
AddLabel(DIVRGNCE, Concat("", Concat ("Divrgnc >< : ", Diff)), Color.PINK);
#AddLabel(DIVRGNCE, "Divergencia > 4", Color.yellow);
AddLabel(CROSSING, "CROSSING", Color.GREEN);
AddLabel(BULLISH, "BULLISH", Color.BLUE);
AddLabel(BEARISH, "BEARISH", Color.RED);
AddLabel(Diff, Concat("" , Concat ("DIV : ", Diff)), Color.YELLOW);
#def spikeDown = if Diff < 0 and Diff = 0 then Color.YELLOW else Color.BLUE);
def ON = if diffA[1] < 0 and diffA >= 0 then 1 else 0;
AddLabel(ON, "SQUEEZE ONN", Color.CYAN);
Alert(ON == 1 , "SQUEEZE ONN !", Alert.BAR, Sound.Ring);
assignpricecolor(if ON == 1 then color.CYAN else color.current);
def OFF = if ON ema then color.green else color.red)
#oscp.assignValueColor(if osc[1] < osc[0] then Color.green else Color.red);
oscp.AssignValueColor(if osc[1] < osc[0] then
if osc[0] >= 0 then
#UpPos
CreateColor(0, 255, 255) else
#UpNeg
CreateColor(204, 0, 204)
else if osc[0] >= 0 then
#DnPos
CreateColor(0, 155, 155) else
#DnNeg
CreateColor(255, 155, 255));
oscp.SetPaintingStrategy( PaintingStrategy.HISTOGRAM);
mid.SetPaintingStrategy(PaintingStrategy.POINTS);