TTM with SQz Confirmation

rvaidyamath

New member
Hello there

Need help o nthis script as I a mtryign to makehe scan signal; its nto letting me to laod as it indicates; its huge code; but i hve seen many longer codes here thatwork well ... here is my code

"
#Raaz_20231227_TTM_Plot_Buy
##AddChartBubble(yes, low, "sQZ ALERT " + TTM_Squeeze().SQUEEZEALERT , Color.WHITE);
##AddChartBubble(yes, low, "hist " + TTM_Squeeze().Histogram , Color.WHITE);

#DEF H9 = ExpAverage(TTM_Squeeze().Histogram, 9);

# Next Work :
# 1. Dont open positions when the alerts are too much progressed on histogram
# 2. set up BBB : 8 > 13 > 21 and 21 > 34 and 21 > 50 and 21 > 144
# 3. set up BBBx : 8 > 13 > 21 > 34
# 4. set up BBBxx : 8 > 13 > 21 > 34 > 50
# 4. set up AAA : 8 > 13 > 21 > 34 > 50 > 144



input price = close;
input L1 = 8;
input L2 = 13;
input L3 = 21;
input L4 = 34;
input L5 = 55;
input L6 = 89;
input L7 = 144;
input L8 = 200;
input disp = 0;
def showind = 1;
def Dispvalue = 1;

DEF A1 = ExpAverage(price, L1);
#A1.SetDefaultColor(Color.Light_Green);
#A1.SetLineWeight(1);

DEF A2 = ExpAverage(price, L2);
#A2.SetDefaultColor(Color.Green);
#A2.SetLineWeight(1);

DEF A3 = ExpAverage(price, L3);
#A3.SetDefaultColor(Color.Green);
#A3.SetLineWeight(4);

DEF A4 = ExpAverage(price, L4);
#A4.SetDefaultColor(Color.blue);
#A4.SetLineWeight(1);

DEF A5 = ExpAverage(price, L5);
#A5.SetDefaultColor(Color.blue);
#A5.SetLineWeight(3);

DEF A6 = ExpAverage(price, L6);
#A6.SetDefaultColor(Color.pink);
#A6.SetLineWeight(3);

DEF A7 = ExpAverage(price, L7);
#A7.SetDefaultColor(Color.light_red);
#A7.SetLineWeight(4);

DEF A8 = ExpAverage(price, L8);
#A8.SetDefaultColor(Color.red);
#A8.SetLineWeight(5);


DEF S55 = SIMPLEMOvingAvg(price, L5);
DEF S200 = SIMPLEMOvingAvg(price, L8);

#AddChartBubble(disp == 1 , low, "a1: " + a1, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a2: " + a2, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a3: " + a3, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a4: " + a4, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a5: " + a5, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a6: " + a6, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a7: " + a7, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a8: " + a8, Color.white, yes);


#addLabel(Dispvalue == 1 , "A1: " + A1, color.CYAN);
#addLabel(Dispvalue == 1 , "A2: " + A2, color.CYAN);
#addLabel(Dispvalue == 1, "A3: " + A3, color.CYAN);
#addLabel(Dispvalue == 1 , "A4: " + A4, color.CYAN);
#addLabel(Dispvalue == 1, "A5: " + A5, color.CYAN);
#addLabel(Dispvalue == 1 , "A6: " + A6, color.CYAN);
#addLabel(Dispvalue == 1 , "A7: " + A7, color.CYAN);
#addLabel(Dispvalue == 1, "A8: " + A8, color.CYAN);

def aPLUS = if A1 > A2 and A2 > A3 and a3 > A4 and a4 > A5 and a5 > A6 and a6 > A7 and a7 > a8 THEN 1 ELSE 0;
def aMINUS = if A1 < A2 and A2 < A3 and a3 < A4 and a4 < A5 and a5 < A6 and a6 < A7 and a7 < a8 THEN 1 ELSE 0;
DEF ANEUTRAL = IF aPLUS == 0 AND aMINUS == 0 THEN 1 ELSE 0;

#addLabel(aPLUS == 1 , "AZone: " + "Intraday BUY NOW!!!! - AAAPlus: Set up!!!", color.green);
#addLabel(aMINUS == 1 , "AZone: " + "IntraDay Sell NOW!!! - AAAMinus: Set Up!!!", color.red);
#addLabel(ANEUTRAL == 1 , "AZone: " + "IntraDay !!!NO Trade for AZone!!! - ANEUTRAL: NO IntraDay !!!", color.gray);
#AddChartBubble(showind == 1 and aPLUS == 1 and aPLUS[1] != 1 , low, "A+" , Color.GREEN, yes);

#AddChartBubble(showind == 1 and aMINUS == 1 and aMINUS[1] != 1, low, "A-" , Color.RED, yes);
#AddChartBubble(showind == 1 and ANEUTRAL == 1 and ANEUTRAL[1] != 1, low, "NA" , Color.GRAY, yes);

def b0 =if A4 > a5 or A4 > a5 or A4 > a6 or A4 > a7 or A4 > a8 then 1 else 0;


def bPLUS = if A1 > A2 and A2 > A3 and a3 > A4 and b0 == 1 THEN 1 ELSE 0;
def bMINUS = if A1 < A2 and A2 < A3 and a3 < A4 and b0 != 1 THEN 1 ELSE 0;
DEF bNEUTRAL = IF bPLUS == 0 AND bMINUS == 0 THEN 1 ELSE 0;

#addLabel(bPLUS == 1 , "BZone: " + "Intraday BUY NOW!!!!", color.light_green);
#addLabel(bMINUS == 1 , "BZone: " + "IntraDay Sell NOW!!!", color.light_red);
#addLabel(ANEUTRAL == 1 , "BZone: " + "IntraDay !!!NO Trade!!!", color.gray);
#AddChartBubble(showind == 1 and bPLUS == 1 and bPLUS[1] != 1 , low, "B+" , Color.GREEN, yes);
#AddChartBubble(showind == 1 and bMINUS == 1 and bMINUS[1] != 1, low, "B-" , Color.RED, yes);
#AddChartBubble(showind == 1 and bNEUTRAL == 1 and bNEUTRAL[1] != 1, low, "NB" , Color.GRAY, yes);

def cPLUS = if A1 > A3 and A3 > A4 and s55 > s200 THEN 1 ELSE 0;
def cMINUS = if A1 < A3 and A3 < A4 and s55 < s200 THEN 1 ELSE 0;
DEF cNEUTRAL = IF cPLUS == 0 AND cMINUS == 0 THEN 1 ELSE 0;

#addLabel(cPLUS == 1 , "CZone: " + "JIntraday BUY NOW!!!!", color.CYAN);
#addLabel(cMINUS == 1 , "CZone: " + "JIntraDay Sell NOW!!!", color.MAGENTA);
#addLabel(ANEUTRAL == 1 , "CZone: " + "JIntraDay !!!NO Trade!!!", color.gray);
#AddChartBubble(showind == 1 and cPLUS == 1 and cPLUS[1] != 1 , low, "C+" , Color.GREEN, yes);
#AddChartBubble(showind == 1 and cMINUS == 1 and cMINUS[1] != 1, low, "C-" , Color.RED, yes);
#AddChartBubble(showind == 1 and cNEUTRAL == 1 and cNEUTRAL[1] != 1, low, "NC" , Color.GRAY, yes);


##AddChartBubble(cPLUS == 1 , low, "C+" , Color.GREEN, yes);
##AddChartBubble(cMINUS == 1 , low, "C-" , Color.RED, yes);
##AddChartBubble(cNEUTRAL == 1 , low, "CN" + ANEUTRAL, Color.GRAY, yes);


#### PRO TTM
def nBB = 2.0;
def Length = 20.0;
def nK_High = 1.0;
def nK_Mid = 1.5;
def nK_Low = 2.0;
#def price = close;

def momentum = TTM_Squeeze(price = price, length = length, nk = nk_Mid, nbb = nbb)."Histogram";
def oscillator = momentum;
def BolKelDelta_Mid = reference BollingerBands("num_dev_up" = nBB, "length" = Length )."upperband" - KeltnerChannels("factor" = nK_Mid, "length" = Length)."Upper_Band";
def BolKelDelta_Low = reference BollingerBands("num_dev_up" = nBB, "length" = Length )."upperband" - KeltnerChannels("factor" = nK_Low, "length" = Length)."Upper_Band";
def BolKelDelta_High = reference BollingerBands("num_dev_up" = nBB, "length" = Length )."upperband" - KeltnerChannels("factor" = nK_High, "length" = Length)."Upper_Band";
#oscillator.DefineColor("Up", CreateColor(0, 255, 255));
#oscillator.DefineColor("UpDecreasing", CreateColor(0, 0, 255));
#oscillator.DefineColor("Down", CreateColor(255, 0, 0));
#oscillator.DefineColor("DownDecreasing", CreateColor(255, 255, 0));
#oscillator.AssignValueColor(
#if oscillator[1] < oscillator then if oscillator[0] >= 0
#then oscillator.Color("Up")
#else oscillator.Color("DownDecreasing")
#else if oscillator >= 0
#then oscillator.Color("UpDecreasing")
#else oscillator.Color("Down") );
#oscillator.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#oscillator.SetLineWeight(5);

#def squeeze = If(IsNaN(close), Double.NaN, 0);
#squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
#squeeze.SetLineWeight(3);
#squeeze.DefineColor("NoSqueeze", Color.GREEN);
#squeeze.DefineColor("SqueezeLow", Color.LIGHT_Red);
#squeeze.DefineColor("SqueezeMid", Color.lIGHT_GREEN);
#squeeze.DefineColor("SqueezeHigh", Color.red);
#squeeze.AssignValueColor(
#if BolKelDelta_High <= 0 then squeeze.Color("SqueezeHigh") else
#if BolKelDelta_Mid <= 0 then squeeze.Color("SqueezeMid") else
#if BolKelDelta_Low <= 0 then squeeze.Color("SqueezeLow") else squeeze.color("noSqueeze"));

def squeezeval = if BolKelDelta_High <= 0 then 1 else
if BolKelDelta_Mid <= 0 then 2 else
if BolKelDelta_Low <= 0 then 3 else 0;

##AddChartBubble(Yes, low, "sq: " + squeezeval , Color.white, yes);
#addLabel(yes , "squeeze value : " + squeezeval, color.yellow);


#def SqueezeR = TTM_Squeeze().SQUEEZEALERT ==0 ;
def SqueezeR = squeezeval != 0 ;
DEF RES = SUM(SqueezeR,5);
#addLabel(RES > 0 , "SqueezeR : " + SqueezeR, color.RED);
#addLabel(RES > 0 , "RES : " + RES, color.RED);

#addLabel(yes , "TTMSqueeze Value : " + ASTEXT(squeezeval), color.white);

#addLabel(yes , "Oscillator : " + ASTEXT(oscillator), color.white);


input averageType = AverageType.EXPONENTIAL;

def Aoscillator = MovingAverage(averageType, oscillator , 14);
#Aoscillator.SetDefaultColor(GlobalColor("Green"));
#Aoscillator.SetPaintingStrategy(PaintingStrategy.line);
#Aoscillator.SetLineWeight(3);

#addLabel(yes , "Aoscillator : " + ASTEXT(Aoscillator), color.white);
#addLabel(yes , "SueezeAlert from TTM orig: " + ASTEXT(TTm_SQUEEZE().sQUEEZEALERT), color.cyan);

DEF OSC_UP_IND = IF oscillator > Aoscillator THEN 1 ELSE 0;
DEF OSC_DN_IND = IF oscillator < Aoscillator THEN 1 ELSE 0;

#####
#TTM LABLES
##addLabel(yes, "sQZ ALERT " + TTM_Squeeze().SQUEEZEALERT , Color.WHITE);
##addLabel(yes, "sQZ HIST " + TTM_Squeeze().Histogram , Color.WHITE);
##addLabel(yes, "sQZ VOLCOMP " + TTM_Squeeze().vOLCOMP , Color.WHITE);
#addLabel(yes, "sQZ Value " + ASTEXT(squeezeval) , Color.WHITE);
#addLabel(yes, "sQZ HIST " + oscillator , Color.WHITE);
##addLabel(yes, "sQZ VOLCOMP " + TTM_Squeeze().vOLCOMP , Color.WHITE);

#AddChartBubble(TTM_Squeeze().vOLCOMP != 0 , low, "TTM_Squeeze().vOLCOMP: " + TTM_Squeeze().vOLCOMP, Color.white, yes);

# 0 means no squeeze , 3 low , 2 med adn 1 high squeeze and 0 means there is no Squeezr its Green
#DEF TTMSQ = TTM_Squeeze().SQUEEZEALERT ;
DEF TTMSQ = squeezeval ;
##AddChartBubble(YES , low, "TTMSQ: " + TTMSQ, Color.WHITE, yes);
#DEF TTMHI = TTM_Squeeze().Histogram ;
DEF TTMHI = oscillator;
##AddChartBubble(YES , low, "TTMHI: " + TTMHI, Color.WHITE, yes);

DEF TTMHI_UP = IF TTMHI > 0 THEN 1 ELSE 0;
DEF TTMHI_DN = IF TTMHI < 0 THEN 1 ELSE 0;

#DEF TTM3S = IF (TTMHI_UP + TTMHI_UP[1] + TTMHI_UP[2] == 3 ) OR
# TTMHI_UP + TTMHI_UP[1] + TTMHI_UP[2] == 3

def TTMHI_uP_CNT = SUM(TTMHI_UP,34);
##AddChartBubble(YES , low, "hiPCNT: " + TTMHI_uP_CNT, Color.LIGHT_GREEN, yes);
def TTMHI_dN_CNT = SUM(TTMHI_DN,34);
##AddChartBubble(YES , low, "hiPCNT: " + TTMHI_dN_CNT, Color.LIGHT_rED, yes);

def momentumLabel;
if TTMHI_uP_CNT > TTMHI_uP_CNT[1] {
momentumLabel = 1;

} else if TTMHI_dN_CNT > TTMHI_dN_CNT[1] {
momentumLabel = -1;

} else {
momentumLabel = 0;

}

# Add a chart bubble with the label
##AddChartBubble(YES, low, "M: " + momentumLabel, Color.white, yes);


DEF TTMHI_uP_CNT_AVG = ExpAverage(TTMHI_uP_CNT, 9);
##AddChartBubble(YES , low, "AVGhiPCNT: " + TTMHI_uP_CNT_AVG, Color.LIGHT_GREEN, yes);

DEF TTMHI_DN_CNT_AVG = ExpAverage(TTMHI_dN_CNT, 9);
##AddChartBubble(YES , low, "hiPNCNT: " + TTMHI_DN_CNT_AVG, Color.LIGHT_rED, yes);
##AddChartBubble(TTMHI_UP == 1 , low, "HISTu: " + TTMHI_UP, Color.GREEN, yes);
##AddChartBubble(TTMHI_DN == 1 , low, "HISTd: " + TTMHI_DN, Color.RED, yes);
#DEF s1 = (A1 - A1[1]) / (price - price[1]) ;
#DEF s2 = (A2 - A2[1]) / (price - price[1]) ;
#DEF s3 = (A3 - A3[1]) / (price - price[1]) ;
#DEF s4 = (A4 - A3[1]) / (price - price[1]) ;
#DEF s5 = (A5 - A5[1]) / (price - price[1]) ;
#DEF s6 = (A6 - A6[1]) / (price - price[1]) ;
#DEF s7 = (A7 - A7[1]) / (price - price[1]) ;
#DEF s8 = (A8 - A8[1]) / (price - price[1]) ;

##addLabel(YES , "s1: " + s1, color.white);
##addLabel(YES , "s2: " + s2, color.white);
##addLabel(YES , "s3: " + s3, color.white);
##addLabel(YES , "s4: " + s4, color.white);
##addLabel(YES , "s5: " + s5, color.white);
##addLabel(YES , "s6: " + s6, color.white);
##addLabel(YES , "s7: " + s7, color.white);
##addLabel(YES , "s8: " + s7, color.white);
;

# Calculate the Average Slope:
#def TS = s1 + s2 + s3 + s4 + s5 + S6 + s7 + s8;
#def ATS = TS / 8;

#def TS1 = s1 + s2 + s3 ;
#def ATS1 = TS1 / 3;

##addLabel(yes, "ATS1 " + ATS1, color.white);
##AddChartBubble(yes , low, "ATS1: " + ATS1, if ATS1 > ATS THEN Color.GREEN ELSE COLOR.RED, yes);

#def TS2 = s4 + s5 + S6 ;
#def ATS2 = TS2 / 3;
##addLabel(yes, "ATS2 " + ATS2, color.white);
##AddChartBubble(yes , low, "ATS2: " + ATS2, if ATS2 > ATS THEN Color.GREEN ELSE COLOR.RED,YES);


#def TS3 = s7 + s8;
#def ATS3 = TS3 / 2;

##addLabel(yes, "ATS3 " + ATS3, color.white);
##AddChartBubble(yes , low, "ATS3: " + ATS3, if ATS3 > ATS THEN Color.GREEN ELSE COLOR.RED, yes);


# Determine Trend Direction:
#def trend_direction = if ATS > 0 then 1 else if ATS < 0 then -1 else 0;
##addLabel(ATS > 0 , "UP " + ATS, color.GREEN);
##addLabel(ATS < 0 , "DN " + ATS, color.RED);
##addLabel(ATS == 0 , "NEUTRAL " +ATS, color.GRAY);

##AddChartBubble(ATS == 0 , low, "sn: " + ATS, Color.GRAY, yes);
##AddChartBubble(ATS > 0 , low, "su: " + ATS, ColOR.GREEN, yes);
##AddChartBubble(ATS < 0 , low, "sd: " + ATS, Color.RED, yes);
# Trailing Stop area

input trailType = {default modified, unmodified};
input ATRPeriod = 5;
input ATRFactor = 3.5;
input firstTrade = {default long, short};
#input averageType = AverageType.hull;

Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);

def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1]
then high - close[1]
else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
then close[1] - low
else (close[1] - low) - 0.5 * (low[1] - high);

def trueRange;
switch (trailType) {
case modified:
trueRange = Max(HiLo, Max(HRef, LRef));
case unmodified:
trueRange = TrueRange(high, close, low);
}
def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);

def state = {default init, long, short};
def trail;
switch (state[1]) {
case init:
if (!IsNaN(loss)) {
switch (firstTrade) {
case long:
state = state.long;
trail = close - loss;
case short:
state = state.short;
trail = close + loss;
}
} else {
state = state.init;
trail = Double.NaN;
}
case long:
if (close > trail[1]) {
state = state.long;
trail = Max(trail[1], close - loss);
} else {
state = state.short;
trail = close + loss;
}
case short:
if (close < trail[1]) {
state = state.short;
trail = Min(trail[1], close + loss);
} else {
state = state.long;
trail = close - loss;
}
}

#def BuySignal = Crosses(state == state.long, 0, CrossingDirection.ABOVE);
#def SellSignal = Crosses(state == state.short, 0, CrossingDirection.ABOVE);

def TrailingStop = trail;
##AddChartBubble(YES , low, "TRS: " + TrailingStop, if close > TrailingStop then Color.green else color.red , yes);
# TTM area
#input price = close;
#input length = 20;
input nK = 1.5;
#input nBB = 2.0;
input alertLine = 1.0;

#def squeezeDots = TTM_Squeeze(price, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots = squeezeval;
#def alertCount = if squeezeDots[1] == 0 and squeezeDots == 1 then 1
# else if squeezeDots == 1 then alertCount[1] + 1
# else 0;
#DEF data = alertCount;

##AddChartBubble(YES , low, "alertCount: " + alertCount, Color.WHITE, yes);


#data.SetDefaultColor(Color.BLACK);

#def squeezeHistogram1 = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
#def sqH = TTM_Squeeze().Histogram ;
#def alert = TTM_Squeeze().SQUEEZEALERT;


#def sqH = oscillator;
#def alert = squeezeval;

#DEF KOLOR = if sqH >= 0
# then if sqH > sqH[1] then 1 else 2
# else if sqH < sqH[1] then 3 else 4 ;
# Define the KOLOR variable based on conditions
def KOLOR;
if oscillator > 0 and oscillator > oscillator[1] {
KOLOR = 2;
} else if oscillator > 0 and oscillator < oscillator[1] {
KOLOR = 1;
} else if oscillator < 0 and oscillator < oscillator[1] {
KOLOR = -2;
} else if oscillator < 0 and oscillator > oscillator[1] {
KOLOR = -1;
} else {
KOLOR = 0; # Default value if none of the conditions are met
}
##AddChartBubble(KOLOR == 2 , low, "COLOR: " + KOLOR, Color.CYAN, yes);
##AddChartBubble(KOLOR == 1 , low, "COLOR: " + KOLOR, Color.BLUE, yes);
##AddChartBubble(KOLOR == -2 , low, "COLOR: " + KOLOR, Color.RED, yes);
##AddChartBubble(KOLOR == -1 , low, "COLOR: " + KOLOR, Color.YELLOW, yes);
##AddChartBubble(KOLOR == 0 , low, "COLOR: " + KOLOR, Color.MAGENTA, yes);


#
## ADX AREA
input ADXlength = 14;
#input averageType = AverageType.ExponeNTIAL;

DEF ADX = DMI(ADXlength, averageType).ADX;
#ADX.setDefaultColor(color.CYAN);
##AddChartBubble(showind == 1 , low, "ADX :" + ADX, Color.gray, yes);
DEF AvgADX = ExpAverage(ADX, 14);
#AvgADX.setDefaultColor(color.white);
##AddChartBubble(showind == 1 , low, "AvgADX :" + AvgADX, Color.gray, yes);
DEF ADX_Low = 20;
#ADX25.setDefaultColor(color.blue);

DEF ADX_TRADE_OPEN = IF ADX >= ADX_Low AND ADX > AvgADX THEN 1 ELSE 0;
####

def bzone = if (ADX_TRADE_OPEN > 0) and squeezeval == 0 and TTMHI > TTMHI[1] and OSC_UP_IND == 1 then 1 else 0;
def szone = if (ADX_TRADE_OPEN > 0) and squeezeval == 0 and TTMHI < TTMHI[1] and OSC_DN_IND == 1 then 1 else 0;
def close_zone = if ADX <= ADX_Low then 1 else 0;
##AddChartBubble(bzone == 1 and szone[1] == 1 , low, "Bzone :" + KOLOR, Color.green, yes);
##AddChartBubble(bzone[1] == 1 and szone == 1, low, "Szone :" + KOLOR, Color.red, yes);
#AddChartBubble(showind == 1 and close_zone == 1, low, "Close zone :" + KOLOR, Color.magenta, yes);

#AddChartBubble(showind == 1 and bzone and bzone[1] != 1, low, "Bzone :" + KOLOR, Color.green, yes);
#AddChartBubble(showind == 1 and szone and szone[1] != 1, low, "Szone :" + KOLOR, Color.red, yes);
##AddChartBubble(close_zone and close_zone[1] != 1, low, "close_zone :" + KOLOR, Color.gray, yes);

##AddChartBubble(close_zone and close_zone[1] != 1, low, "ADX :" + ADX, Color.gray, yes);

##AddChartBubble(close_zone and close_zone[1] != 1, low, "AvgADX :" + AvgADX, Color.gray, yes);

####

# Squeeze condition
#def sqz3 = if squeezeval != 0 and squeezeval[1] != 0 and squeezeval[2] != 0 then 1 else 0;
def sqzvalue = Sum(squeezeval, 5);
##AddChartBubble(sqzvalue > 0, low, "sqz :" + sqzvalue, Color.cyan, yes);
def sqz3 = if sqzvalue > 0 and squeezeval == 0 then 1 else 0;
def Close_pos = if sqzvalue > 2 OR OSCILLATOR CROSSES 0 then 1 else 0;

##AddChartBubble(YES, low, "sqz3 :" + Sum(squeezeval[1], 2), Color.cyan, yes);
def fire_begin = if squeezeval > 0 AND squeezeval[1] == 0 then 1 else 0 ;
#AddChartBubble(fire_begin == 1 , low, "Fire/Sqz :" + "Begins " + squeezeval, Color.magenta, yes);
def fire_progressc = if squeezeval > 0 AND squeezeval[1] > 0 then 1 else 0 ;
def fire_progress = if fire_progressc == 1 AND fire_progressc[1] != 1 then 1 else 0 ;
#AddChartBubble(fire_progress == 1 , low, "Fire/Sqz :" + "Progress " + squeezeval, Color.magenta, yes);
def fire_endc = if squeezeval == 0 AND squeezeval[1] > 0 then 1 else 0 ;
def fire_end = if fire_endc == 1 AND fire_endc[1] != 1 then 1 else 0 ;
#AddChartBubble(fire_end == 1 , low, "Fire/Sqz :" + "Ends", Color.magenta, yes);
def fire = if squeezeval[0] == 0 and sqzvalue > 2 then 1 else 0;
#AddChartBubble(fire == 1 and fire[1] != 1 , low, "Fire/Sqz :" + "Trade", Color.magenta, yes);


#addLabel(fire_begin == 1 , "FIRE: " + "Begins" + sqzvalue, color.MAGENTA);
#addLabel(fire_progressc == 1, "FIRE: " + "Progress " + sqzvalue, color.magenta);
#addLabel(fire_end == 1, "FIRE: " + " Ends " + sqzvalue, color.magenta);
#addLabel(fire == 1, "FIRE: " + "Trade - check conditions " + sqzvalue, color.magenta);



#cONDITIONS
def c1B = if low > a3 and high > a3 then 1 else 0 ;
def c1S = if low < a3 and high < a3 then 1 else 0 ;
def c2B = if c1B == 1 and bzone == 1 then 1 else 0; ;
def c2S = if c1S == 1 and szone == 1 then 1 else 0;
def c3B = if price > a5 then 1 else 0; # 55 Length
def c3S = if price < a5 then 1 else 0; # 55 Length
def c4B = if price > a8 then 1 else 0; # 200 Length
def c4S = if price < a8 then 1 else 0; # 200 Length
def c5B = if price > TrailingStop then 1 else 0;
def c5S = if price < TrailingStop then 1 else 0;
def c6 = if oscillator crosses 0 then 1 else 0;



def fire5up = if fire == 1 and c5B == 1 and bzone == 1 then 1 else 0;
def fire5dn = if fire == 1 and c5S == 1 and szone == 1 then 1 else 0;
##AddChartBubble(fire5up == 1 and fire5up[1] != 1, low, "fire5up :" + "Upward Fire", Color.white, yes);
##AddChartBubble(fire5dn == 1 and fire5dn[1] != 1, low, "fire5Dn :" + "Dnward Fire", Color.white, yes);

##AddChartBubble(yes, low, "price :" + price, Color.white, yes);
##AddChartBubble(yes, low, "TrailingStop :" + TrailingStop, Color.white, yes);
# buy condition
def b1 = if C1B == 1 and C2b == 1 and c5B == 1 and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b2 = if bPLUS == 1 and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b3 = if fire5up == 1 and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b4 = if price > TrailingStop and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b5 = if (aPlus == 1 OR bPLUS == 1 OR CPLUS == 1 ) and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
##AddChartBubble(b4 == 1, low, "price :" + price, Color.green, yes);
##AddChartBubble(b4 == 1, low, "TrailingStop :" + TrailingStop, Color.green, yes);
##AddChartBubble(yes, low, "b1 :" + b1, Color.green, yes);
##AddChartBubble(yes, low, "b2 :" + b2, Color.green, yes);
##AddChartBubble(yes, low, "b3 :" + b3, Color.green, yes);
##AddChartBubble(yes, low, "b4 :" + b4, Color.green, yes);


def bSignal = if b1 == 1 OR b2 == 1 or b3 == 1 or b4 == 1
OR B5 == 1
then 1 else 0;
##AddChartBubble( bSignal == 1 , low, "Long Signal" , Color.green, yes);
def buy = if bSignal == 1 and bSignal[1] != 1 then 1 else 0 ;
##AddChartBubble( buy == 1 , low, "Buy: " + close, Color.green, yes);
#AddChartBubble(buy == 1 , low, "Long/Buy" , Color.green, yes);
plot BuypLOT = if buy == 1
then LOW else DOUBle.NaN;
BuypLOT.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
BuypLOT.SetLineWeight(5);
BuypLOT.SetDefaultColor(Color.green);

##AddChartBubble(buy == 1, low, "price :" + price, Color.green, yes);
##AddChartBubble(buy == 1, low, "TrailingStop :" + TrailingStop, Color.green, yes);
##AddChartBubble(buy == 1, low, "b1 :" + b1, Color.green, yes);
##AddChartBubble(buy == 1, low, "b2 :" + b2, Color.green, yes);
##AddChartBubble(buy == 1, low, "b3 :" + b3, Color.green, yes);
##AddChartBubble(buy == 1, low, "b4 :" + b4, Color.green, yes);

# Sell condition
def s1 = if C1S == 1 and C2S == 1 and c5S == 1 and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def s2 = if bMINUS == 1 and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def s3 = if fire5dn == 1 and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def s4 = if price < TrailingStop and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def S5 = if (aMINUS == 1 OR bMINUS == 1 OR CMINUS == 1) and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
##AddChartBubble(szone == 1, low, "price :" + price, Color.red, yes);
##AddChartBubble(szone == 1, low, "TrailingStop :" + TrailingStop, Color.red, yes);
def SSignal = if s1 == 1 or s2 == 1 or s3 == 1 or s4 == 1
OR S5 == 1
then 1 else 0;
##AddChartBubble( SSignal == 1 , low, "Short Signal" , Color.red, yes);
def sell = if sSignal == 1 and sSignal[1] != 1 then 1 else 0;
##AddChartBubble(sell , low, "Sell: " + close, Color.red, yes);
#AddChartBubble(sell , low, "Short/Sell" , Color.red, yes);

def sELLLOT = if buy == 1
then LOW else DOUBle.NaN;
#sELLLOT.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#sELLLOT.SetLineWeight(5);
#sELLLOT.SetDefaultColor(Color.rED);

# Close buy condition
Def b1s = if SSignal == 1 or fire_begin == 1
#szone == 1 or Close_pos == 1 OR ( OSC_DN_IND == 1 )
#or close_zone == 1
#AND (CLOSE < A5 OR CLOSE < TrailingStop OR SQZ3 )
THEN 1 ELSE 0;
##AddChartBubble(b1s == 1 , low, "szone: " + szone , Color.light_red, yes);
Def b2s = if SSignal == 1
#OR TTMHI_DN == 1 OR c6 == 1
THEN 1 ELSE 0;

Def buyclose_Signal1 = IF b1s == 1 OR B2S == 1 or sqz3 == 1 THEN 1 ELSE 0;
Def buyclose_Signal = IF buyclose_Signal1 == 1 and bSignal != 1 THEN 1 ELSE 0;
##AddChartBubble(buyclose_Signal == 1 and buyclose_Signal[1] != 1 , low, "Buy Close: " + close, Color.light_red, yes);

#AddChartBubble(buyclose_Signal == 1 and buyclose_Signal[1] != 1 , low, "BC: " , Color.light_red, yes);

def BuyClosepLOT = if buyclose_Signal == 1 and buyclose_Signal[1] != 1
then LOW else DOUBle.NaN;
#BuyClosepLOT.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#BuyClosepLOT.SetLineWeight(5);
#BuyClosepLOT.SetDefaultColor(Color.LIGHT_rED);



###
##AddChartBubble(buy == 1 , low, "AVGhiPCNT: " + TTMHI_uP_CNT_AVG, Color.LIGHT_GREEN, yes);
##AddChartBubble(sell == 1 , low, "hiPNCNT: " + TTMHI_DN_CNT_AVG, Color.LIGHT_rED, yes);
###


# Close Sell condition
Def S1s = IF bSignal == 1 or fire_begin == 1
#or bzone == 1 or Close_pos == 1 OR OSC_UP_IND == 1
# or close_zone == 1
#AND (CLOSE > A5 OR CLOSE > TrailingStop OR SQZ3 )
THEN 1 ELSE 0;
Def S2s = IF BSignal == 1
#OR TTMHI_UP == 1 OR c6 == 1 or sqz3 == 1
THEN 1 ELSE 0;
Def Sellclose_Signal1 = IF s1s OR S2s == 1 or sqz3 == 1 THEN 1 ELSE 0;
Def Sellclose_Signal = IF Sellclose_Signal1 == 1 and SSignal != 1 THEN 1 ELSE 0;
##AddChartBubble(Sellclose_Signal == 1 and Sellclose_Signal[1] != 1 , low, "Sell Close: " + close, Color.light_green, yes);

#AddChartBubble(Sellclose_Signal == 1 and Sellclose_Signal[1] != 1 , low, "SC" , Color.light_green, yes);

def SellCoverLOT = if Sellclose_Signal == 1 and Sellclose_Signal[1] != 1
then LOW else DOUBle.NaN;
#SellCoverLOT.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#SellCoverLOT.SetLineWeight(5);
#SellCoverLOT.SetDefaultColor(Color.LIGHT_green);


#
# Assigning color and labels based on conditions
#addLabel(yes, if bSignal == 1 then "B" else if SSignal == 1 then "S" else if buyclose_Signal1 == 1 then "BC" else if Sellclose_Signal1 == 1 then "SC" else "",
# if bSignal == 1 then
# if bSignal[1] == bSignal then Color.GRAY else #Color.GREEN
# else if SSignal == 1 then
# if SSignal[1] == SSignal then Color.GRAY else #Color.RED
# else if buyclose_Signal1 == 1 then
# if buyclose_Signal1[1] == buyclose_Signal1 then #Color.GRAY else Color.LIGHT_RED
# else if Sellclose_Signal1 == 1 then
# if Sellclose_Signal1[1] == Sellclose_Signal1 then #Color.GRAY else Color.LIGHT_GREEN
# else
# Color.WHITE # Default color if none of the #conditions are met
#);

# If you also want to plot points with colors
#plot pvalue = Double.NaN; # Initializing plot with no value
#pvalue.SetPaintingStrategy(PaintingStrategy.POINTS);
#pvalue.AssignValueColor(if bSignal == 1 then if bSignal[1] == bSignal then Color.GRAY else Color.GREEN else if SSignal == 1 then if SSignal[1] == SSignal then Color.GRAY else Color.RED else if buyclose_Signal1 == 1 then if buyclose_Signal1[1] == #buyclose_Signal1 then Color.GRAY else Color.LIGHT_RED else if Sellclose_Signal1 == 1 then if Sellclose_Signal1[1] == Sellclose_Signal1 then Color.GRAY else Color.LIGHT_GREEN else Color.WHITE);
#Raaz_20231227_TTM_Plot_Buy

Bst
Raj
 
Solution
Hello there

Need help o nthis script as I a mtryign to makehe scan signal; its nto letting me to laod as it indicates; its huge code; but i hve seen many longer codes here thatwork well ... here is my code

"
#Raaz_20231227_TTM_Plot_Buy
##AddChartBubble(yes, low, "sQZ ALERT " + TTM_Squeeze().SQUEEZEALERT , Color.WHITE);
##AddChartBubble(yes, low, "hist " + TTM_Squeeze().Histogram , Color.WHITE);

#DEF H9 = ExpAverage(TTM_Squeeze().Histogram, 9);

# Next Work :
# 1. Dont open positions when the alerts are too much progressed on histogram
# 2. set up BBB : 8 > 13 > 21 and 21 > 34 and 21 > 50 and 21 > 144
# 3. set up BBBx : 8 > 13 > 21 > 34
# 4. set up BBBxx : 8 > 13 > 21 > 34 > 50
# 4. set up AAA : 8 > 13 > 21 > 34 > 50 > 144...
Hello there

Need help o nthis script as I a mtryign to makehe scan signal; its nto letting me to laod as it indicates; its huge code; but i hve seen many longer codes here thatwork well ... here is my code

"
#Raaz_20231227_TTM_Plot_Buy
##AddChartBubble(yes, low, "sQZ ALERT " + TTM_Squeeze().SQUEEZEALERT , Color.WHITE);
##AddChartBubble(yes, low, "hist " + TTM_Squeeze().Histogram , Color.WHITE);

#DEF H9 = ExpAverage(TTM_Squeeze().Histogram, 9);

# Next Work :
# 1. Dont open positions when the alerts are too much progressed on histogram
# 2. set up BBB : 8 > 13 > 21 and 21 > 34 and 21 > 50 and 21 > 144
# 3. set up BBBx : 8 > 13 > 21 > 34
# 4. set up BBBxx : 8 > 13 > 21 > 34 > 50
# 4. set up AAA : 8 > 13 > 21 > 34 > 50 > 144



input price = close;
input L1 = 8;
input L2 = 13;
input L3 = 21;
input L4 = 34;
input L5 = 55;
input L6 = 89;
input L7 = 144;
input L8 = 200;
input disp = 0;
def showind = 1;
def Dispvalue = 1;

DEF A1 = ExpAverage(price, L1);
#A1.SetDefaultColor(Color.Light_Green);
#A1.SetLineWeight(1);

DEF A2 = ExpAverage(price, L2);
#A2.SetDefaultColor(Color.Green);
#A2.SetLineWeight(1);

DEF A3 = ExpAverage(price, L3);
#A3.SetDefaultColor(Color.Green);
#A3.SetLineWeight(4);

DEF A4 = ExpAverage(price, L4);
#A4.SetDefaultColor(Color.blue);
#A4.SetLineWeight(1);

DEF A5 = ExpAverage(price, L5);
#A5.SetDefaultColor(Color.blue);
#A5.SetLineWeight(3);

DEF A6 = ExpAverage(price, L6);
#A6.SetDefaultColor(Color.pink);
#A6.SetLineWeight(3);

DEF A7 = ExpAverage(price, L7);
#A7.SetDefaultColor(Color.light_red);
#A7.SetLineWeight(4);

DEF A8 = ExpAverage(price, L8);
#A8.SetDefaultColor(Color.red);
#A8.SetLineWeight(5);


DEF S55 = SIMPLEMOvingAvg(price, L5);
DEF S200 = SIMPLEMOvingAvg(price, L8);

#AddChartBubble(disp == 1 , low, "a1: " + a1, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a2: " + a2, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a3: " + a3, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a4: " + a4, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a5: " + a5, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a6: " + a6, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a7: " + a7, Color.white, yes);
#AddChartBubble(disp == 1 , low, "a8: " + a8, Color.white, yes);


#addLabel(Dispvalue == 1 , "A1: " + A1, color.CYAN);
#addLabel(Dispvalue == 1 , "A2: " + A2, color.CYAN);
#addLabel(Dispvalue == 1, "A3: " + A3, color.CYAN);
#addLabel(Dispvalue == 1 , "A4: " + A4, color.CYAN);
#addLabel(Dispvalue == 1, "A5: " + A5, color.CYAN);
#addLabel(Dispvalue == 1 , "A6: " + A6, color.CYAN);
#addLabel(Dispvalue == 1 , "A7: " + A7, color.CYAN);
#addLabel(Dispvalue == 1, "A8: " + A8, color.CYAN);

def aPLUS = if A1 > A2 and A2 > A3 and a3 > A4 and a4 > A5 and a5 > A6 and a6 > A7 and a7 > a8 THEN 1 ELSE 0;
def aMINUS = if A1 < A2 and A2 < A3 and a3 < A4 and a4 < A5 and a5 < A6 and a6 < A7 and a7 < a8 THEN 1 ELSE 0;
DEF ANEUTRAL = IF aPLUS == 0 AND aMINUS == 0 THEN 1 ELSE 0;

#addLabel(aPLUS == 1 , "AZone: " + "Intraday BUY NOW!!!! - AAAPlus: Set up!!!", color.green);
#addLabel(aMINUS == 1 , "AZone: " + "IntraDay Sell NOW!!! - AAAMinus: Set Up!!!", color.red);
#addLabel(ANEUTRAL == 1 , "AZone: " + "IntraDay !!!NO Trade for AZone!!! - ANEUTRAL: NO IntraDay !!!", color.gray);
#AddChartBubble(showind == 1 and aPLUS == 1 and aPLUS[1] != 1 , low, "A+" , Color.GREEN, yes);

#AddChartBubble(showind == 1 and aMINUS == 1 and aMINUS[1] != 1, low, "A-" , Color.RED, yes);
#AddChartBubble(showind == 1 and ANEUTRAL == 1 and ANEUTRAL[1] != 1, low, "NA" , Color.GRAY, yes);

def b0 =if A4 > a5 or A4 > a5 or A4 > a6 or A4 > a7 or A4 > a8 then 1 else 0;


def bPLUS = if A1 > A2 and A2 > A3 and a3 > A4 and b0 == 1 THEN 1 ELSE 0;
def bMINUS = if A1 < A2 and A2 < A3 and a3 < A4 and b0 != 1 THEN 1 ELSE 0;
DEF bNEUTRAL = IF bPLUS == 0 AND bMINUS == 0 THEN 1 ELSE 0;

#addLabel(bPLUS == 1 , "BZone: " + "Intraday BUY NOW!!!!", color.light_green);
#addLabel(bMINUS == 1 , "BZone: " + "IntraDay Sell NOW!!!", color.light_red);
#addLabel(ANEUTRAL == 1 , "BZone: " + "IntraDay !!!NO Trade!!!", color.gray);
#AddChartBubble(showind == 1 and bPLUS == 1 and bPLUS[1] != 1 , low, "B+" , Color.GREEN, yes);
#AddChartBubble(showind == 1 and bMINUS == 1 and bMINUS[1] != 1, low, "B-" , Color.RED, yes);
#AddChartBubble(showind == 1 and bNEUTRAL == 1 and bNEUTRAL[1] != 1, low, "NB" , Color.GRAY, yes);

def cPLUS = if A1 > A3 and A3 > A4 and s55 > s200 THEN 1 ELSE 0;
def cMINUS = if A1 < A3 and A3 < A4 and s55 < s200 THEN 1 ELSE 0;
DEF cNEUTRAL = IF cPLUS == 0 AND cMINUS == 0 THEN 1 ELSE 0;

#addLabel(cPLUS == 1 , "CZone: " + "JIntraday BUY NOW!!!!", color.CYAN);
#addLabel(cMINUS == 1 , "CZone: " + "JIntraDay Sell NOW!!!", color.MAGENTA);
#addLabel(ANEUTRAL == 1 , "CZone: " + "JIntraDay !!!NO Trade!!!", color.gray);
#AddChartBubble(showind == 1 and cPLUS == 1 and cPLUS[1] != 1 , low, "C+" , Color.GREEN, yes);
#AddChartBubble(showind == 1 and cMINUS == 1 and cMINUS[1] != 1, low, "C-" , Color.RED, yes);
#AddChartBubble(showind == 1 and cNEUTRAL == 1 and cNEUTRAL[1] != 1, low, "NC" , Color.GRAY, yes);


##AddChartBubble(cPLUS == 1 , low, "C+" , Color.GREEN, yes);
##AddChartBubble(cMINUS == 1 , low, "C-" , Color.RED, yes);
##AddChartBubble(cNEUTRAL == 1 , low, "CN" + ANEUTRAL, Color.GRAY, yes);


#### PRO TTM
def nBB = 2.0;
def Length = 20.0;
def nK_High = 1.0;
def nK_Mid = 1.5;
def nK_Low = 2.0;
#def price = close;

def momentum = TTM_Squeeze(price = price, length = length, nk = nk_Mid, nbb = nbb)."Histogram";
def oscillator = momentum;
def BolKelDelta_Mid = reference BollingerBands("num_dev_up" = nBB, "length" = Length )."upperband" - KeltnerChannels("factor" = nK_Mid, "length" = Length)."Upper_Band";
def BolKelDelta_Low = reference BollingerBands("num_dev_up" = nBB, "length" = Length )."upperband" - KeltnerChannels("factor" = nK_Low, "length" = Length)."Upper_Band";
def BolKelDelta_High = reference BollingerBands("num_dev_up" = nBB, "length" = Length )."upperband" - KeltnerChannels("factor" = nK_High, "length" = Length)."Upper_Band";
#oscillator.DefineColor("Up", CreateColor(0, 255, 255));
#oscillator.DefineColor("UpDecreasing", CreateColor(0, 0, 255));
#oscillator.DefineColor("Down", CreateColor(255, 0, 0));
#oscillator.DefineColor("DownDecreasing", CreateColor(255, 255, 0));
#oscillator.AssignValueColor(
#if oscillator[1] < oscillator then if oscillator[0] >= 0
#then oscillator.Color("Up")
#else oscillator.Color("DownDecreasing")
#else if oscillator >= 0
#then oscillator.Color("UpDecreasing")
#else oscillator.Color("Down") );
#oscillator.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#oscillator.SetLineWeight(5);

#def squeeze = If(IsNaN(close), Double.NaN, 0);
#squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
#squeeze.SetLineWeight(3);
#squeeze.DefineColor("NoSqueeze", Color.GREEN);
#squeeze.DefineColor("SqueezeLow", Color.LIGHT_Red);
#squeeze.DefineColor("SqueezeMid", Color.lIGHT_GREEN);
#squeeze.DefineColor("SqueezeHigh", Color.red);
#squeeze.AssignValueColor(
#if BolKelDelta_High <= 0 then squeeze.Color("SqueezeHigh") else
#if BolKelDelta_Mid <= 0 then squeeze.Color("SqueezeMid") else
#if BolKelDelta_Low <= 0 then squeeze.Color("SqueezeLow") else squeeze.color("noSqueeze"));

def squeezeval = if BolKelDelta_High <= 0 then 1 else
if BolKelDelta_Mid <= 0 then 2 else
if BolKelDelta_Low <= 0 then 3 else 0;

##AddChartBubble(Yes, low, "sq: " + squeezeval , Color.white, yes);
#addLabel(yes , "squeeze value : " + squeezeval, color.yellow);


#def SqueezeR = TTM_Squeeze().SQUEEZEALERT ==0 ;
def SqueezeR = squeezeval != 0 ;
DEF RES = SUM(SqueezeR,5);
#addLabel(RES > 0 , "SqueezeR : " + SqueezeR, color.RED);
#addLabel(RES > 0 , "RES : " + RES, color.RED);

#addLabel(yes , "TTMSqueeze Value : " + ASTEXT(squeezeval), color.white);

#addLabel(yes , "Oscillator : " + ASTEXT(oscillator), color.white);


input averageType = AverageType.EXPONENTIAL;

def Aoscillator = MovingAverage(averageType, oscillator , 14);
#Aoscillator.SetDefaultColor(GlobalColor("Green"));
#Aoscillator.SetPaintingStrategy(PaintingStrategy.line);
#Aoscillator.SetLineWeight(3);

#addLabel(yes , "Aoscillator : " + ASTEXT(Aoscillator), color.white);
#addLabel(yes , "SueezeAlert from TTM orig: " + ASTEXT(TTm_SQUEEZE().sQUEEZEALERT), color.cyan);

DEF OSC_UP_IND = IF oscillator > Aoscillator THEN 1 ELSE 0;
DEF OSC_DN_IND = IF oscillator < Aoscillator THEN 1 ELSE 0;

#####
#TTM LABLES
##addLabel(yes, "sQZ ALERT " + TTM_Squeeze().SQUEEZEALERT , Color.WHITE);
##addLabel(yes, "sQZ HIST " + TTM_Squeeze().Histogram , Color.WHITE);
##addLabel(yes, "sQZ VOLCOMP " + TTM_Squeeze().vOLCOMP , Color.WHITE);
#addLabel(yes, "sQZ Value " + ASTEXT(squeezeval) , Color.WHITE);
#addLabel(yes, "sQZ HIST " + oscillator , Color.WHITE);
##addLabel(yes, "sQZ VOLCOMP " + TTM_Squeeze().vOLCOMP , Color.WHITE);

#AddChartBubble(TTM_Squeeze().vOLCOMP != 0 , low, "TTM_Squeeze().vOLCOMP: " + TTM_Squeeze().vOLCOMP, Color.white, yes);

# 0 means no squeeze , 3 low , 2 med adn 1 high squeeze and 0 means there is no Squeezr its Green
#DEF TTMSQ = TTM_Squeeze().SQUEEZEALERT ;
DEF TTMSQ = squeezeval ;
##AddChartBubble(YES , low, "TTMSQ: " + TTMSQ, Color.WHITE, yes);
#DEF TTMHI = TTM_Squeeze().Histogram ;
DEF TTMHI = oscillator;
##AddChartBubble(YES , low, "TTMHI: " + TTMHI, Color.WHITE, yes);

DEF TTMHI_UP = IF TTMHI > 0 THEN 1 ELSE 0;
DEF TTMHI_DN = IF TTMHI < 0 THEN 1 ELSE 0;

#DEF TTM3S = IF (TTMHI_UP + TTMHI_UP[1] + TTMHI_UP[2] == 3 ) OR
# TTMHI_UP + TTMHI_UP[1] + TTMHI_UP[2] == 3

def TTMHI_uP_CNT = SUM(TTMHI_UP,34);
##AddChartBubble(YES , low, "hiPCNT: " + TTMHI_uP_CNT, Color.LIGHT_GREEN, yes);
def TTMHI_dN_CNT = SUM(TTMHI_DN,34);
##AddChartBubble(YES , low, "hiPCNT: " + TTMHI_dN_CNT, Color.LIGHT_rED, yes);

def momentumLabel;
if TTMHI_uP_CNT > TTMHI_uP_CNT[1] {
momentumLabel = 1;

} else if TTMHI_dN_CNT > TTMHI_dN_CNT[1] {
momentumLabel = -1;

} else {
momentumLabel = 0;

}

# Add a chart bubble with the label
##AddChartBubble(YES, low, "M: " + momentumLabel, Color.white, yes);


DEF TTMHI_uP_CNT_AVG = ExpAverage(TTMHI_uP_CNT, 9);
##AddChartBubble(YES , low, "AVGhiPCNT: " + TTMHI_uP_CNT_AVG, Color.LIGHT_GREEN, yes);

DEF TTMHI_DN_CNT_AVG = ExpAverage(TTMHI_dN_CNT, 9);
##AddChartBubble(YES , low, "hiPNCNT: " + TTMHI_DN_CNT_AVG, Color.LIGHT_rED, yes);
##AddChartBubble(TTMHI_UP == 1 , low, "HISTu: " + TTMHI_UP, Color.GREEN, yes);
##AddChartBubble(TTMHI_DN == 1 , low, "HISTd: " + TTMHI_DN, Color.RED, yes);
#DEF s1 = (A1 - A1[1]) / (price - price[1]) ;
#DEF s2 = (A2 - A2[1]) / (price - price[1]) ;
#DEF s3 = (A3 - A3[1]) / (price - price[1]) ;
#DEF s4 = (A4 - A3[1]) / (price - price[1]) ;
#DEF s5 = (A5 - A5[1]) / (price - price[1]) ;
#DEF s6 = (A6 - A6[1]) / (price - price[1]) ;
#DEF s7 = (A7 - A7[1]) / (price - price[1]) ;
#DEF s8 = (A8 - A8[1]) / (price - price[1]) ;

##addLabel(YES , "s1: " + s1, color.white);
##addLabel(YES , "s2: " + s2, color.white);
##addLabel(YES , "s3: " + s3, color.white);
##addLabel(YES , "s4: " + s4, color.white);
##addLabel(YES , "s5: " + s5, color.white);
##addLabel(YES , "s6: " + s6, color.white);
##addLabel(YES , "s7: " + s7, color.white);
##addLabel(YES , "s8: " + s7, color.white);
;

# Calculate the Average Slope:
#def TS = s1 + s2 + s3 + s4 + s5 + S6 + s7 + s8;
#def ATS = TS / 8;

#def TS1 = s1 + s2 + s3 ;
#def ATS1 = TS1 / 3;

##addLabel(yes, "ATS1 " + ATS1, color.white);
##AddChartBubble(yes , low, "ATS1: " + ATS1, if ATS1 > ATS THEN Color.GREEN ELSE COLOR.RED, yes);

#def TS2 = s4 + s5 + S6 ;
#def ATS2 = TS2 / 3;
##addLabel(yes, "ATS2 " + ATS2, color.white);
##AddChartBubble(yes , low, "ATS2: " + ATS2, if ATS2 > ATS THEN Color.GREEN ELSE COLOR.RED,YES);


#def TS3 = s7 + s8;
#def ATS3 = TS3 / 2;

##addLabel(yes, "ATS3 " + ATS3, color.white);
##AddChartBubble(yes , low, "ATS3: " + ATS3, if ATS3 > ATS THEN Color.GREEN ELSE COLOR.RED, yes);


# Determine Trend Direction:
#def trend_direction = if ATS > 0 then 1 else if ATS < 0 then -1 else 0;
##addLabel(ATS > 0 , "UP " + ATS, color.GREEN);
##addLabel(ATS < 0 , "DN " + ATS, color.RED);
##addLabel(ATS == 0 , "NEUTRAL " +ATS, color.GRAY);

##AddChartBubble(ATS == 0 , low, "sn: " + ATS, Color.GRAY, yes);
##AddChartBubble(ATS > 0 , low, "su: " + ATS, ColOR.GREEN, yes);
##AddChartBubble(ATS < 0 , low, "sd: " + ATS, Color.RED, yes);
# Trailing Stop area

input trailType = {default modified, unmodified};
input ATRPeriod = 5;
input ATRFactor = 3.5;
input firstTrade = {default long, short};
#input averageType = AverageType.hull;

Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);

def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1]
then high - close[1]
else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
then close[1] - low
else (close[1] - low) - 0.5 * (low[1] - high);

def trueRange;
switch (trailType) {
case modified:
trueRange = Max(HiLo, Max(HRef, LRef));
case unmodified:
trueRange = TrueRange(high, close, low);
}
def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);

def state = {default init, long, short};
def trail;
switch (state[1]) {
case init:
if (!IsNaN(loss)) {
switch (firstTrade) {
case long:
state = state.long;
trail = close - loss;
case short:
state = state.short;
trail = close + loss;
}
} else {
state = state.init;
trail = Double.NaN;
}
case long:
if (close > trail[1]) {
state = state.long;
trail = Max(trail[1], close - loss);
} else {
state = state.short;
trail = close + loss;
}
case short:
if (close < trail[1]) {
state = state.short;
trail = Min(trail[1], close + loss);
} else {
state = state.long;
trail = close - loss;
}
}

#def BuySignal = Crosses(state == state.long, 0, CrossingDirection.ABOVE);
#def SellSignal = Crosses(state == state.short, 0, CrossingDirection.ABOVE);

def TrailingStop = trail;
##AddChartBubble(YES , low, "TRS: " + TrailingStop, if close > TrailingStop then Color.green else color.red , yes);
# TTM area
#input price = close;
#input length = 20;
input nK = 1.5;
#input nBB = 2.0;
input alertLine = 1.0;

#def squeezeDots = TTM_Squeeze(price, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots = squeezeval;
#def alertCount = if squeezeDots[1] == 0 and squeezeDots == 1 then 1
# else if squeezeDots == 1 then alertCount[1] + 1
# else 0;
#DEF data = alertCount;

##AddChartBubble(YES , low, "alertCount: " + alertCount, Color.WHITE, yes);


#data.SetDefaultColor(Color.BLACK);

#def squeezeHistogram1 = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
#def sqH = TTM_Squeeze().Histogram ;
#def alert = TTM_Squeeze().SQUEEZEALERT;


#def sqH = oscillator;
#def alert = squeezeval;

#DEF KOLOR = if sqH >= 0
# then if sqH > sqH[1] then 1 else 2
# else if sqH < sqH[1] then 3 else 4 ;
# Define the KOLOR variable based on conditions
def KOLOR;
if oscillator > 0 and oscillator > oscillator[1] {
KOLOR = 2;
} else if oscillator > 0 and oscillator < oscillator[1] {
KOLOR = 1;
} else if oscillator < 0 and oscillator < oscillator[1] {
KOLOR = -2;
} else if oscillator < 0 and oscillator > oscillator[1] {
KOLOR = -1;
} else {
KOLOR = 0; # Default value if none of the conditions are met
}
##AddChartBubble(KOLOR == 2 , low, "COLOR: " + KOLOR, Color.CYAN, yes);
##AddChartBubble(KOLOR == 1 , low, "COLOR: " + KOLOR, Color.BLUE, yes);
##AddChartBubble(KOLOR == -2 , low, "COLOR: " + KOLOR, Color.RED, yes);
##AddChartBubble(KOLOR == -1 , low, "COLOR: " + KOLOR, Color.YELLOW, yes);
##AddChartBubble(KOLOR == 0 , low, "COLOR: " + KOLOR, Color.MAGENTA, yes);


#
## ADX AREA
input ADXlength = 14;
#input averageType = AverageType.ExponeNTIAL;

DEF ADX = DMI(ADXlength, averageType).ADX;
#ADX.setDefaultColor(color.CYAN);
##AddChartBubble(showind == 1 , low, "ADX :" + ADX, Color.gray, yes);
DEF AvgADX = ExpAverage(ADX, 14);
#AvgADX.setDefaultColor(color.white);
##AddChartBubble(showind == 1 , low, "AvgADX :" + AvgADX, Color.gray, yes);
DEF ADX_Low = 20;
#ADX25.setDefaultColor(color.blue);

DEF ADX_TRADE_OPEN = IF ADX >= ADX_Low AND ADX > AvgADX THEN 1 ELSE 0;
####

def bzone = if (ADX_TRADE_OPEN > 0) and squeezeval == 0 and TTMHI > TTMHI[1] and OSC_UP_IND == 1 then 1 else 0;
def szone = if (ADX_TRADE_OPEN > 0) and squeezeval == 0 and TTMHI < TTMHI[1] and OSC_DN_IND == 1 then 1 else 0;
def close_zone = if ADX <= ADX_Low then 1 else 0;
##AddChartBubble(bzone == 1 and szone[1] == 1 , low, "Bzone :" + KOLOR, Color.green, yes);
##AddChartBubble(bzone[1] == 1 and szone == 1, low, "Szone :" + KOLOR, Color.red, yes);
#AddChartBubble(showind == 1 and close_zone == 1, low, "Close zone :" + KOLOR, Color.magenta, yes);

#AddChartBubble(showind == 1 and bzone and bzone[1] != 1, low, "Bzone :" + KOLOR, Color.green, yes);
#AddChartBubble(showind == 1 and szone and szone[1] != 1, low, "Szone :" + KOLOR, Color.red, yes);
##AddChartBubble(close_zone and close_zone[1] != 1, low, "close_zone :" + KOLOR, Color.gray, yes);

##AddChartBubble(close_zone and close_zone[1] != 1, low, "ADX :" + ADX, Color.gray, yes);

##AddChartBubble(close_zone and close_zone[1] != 1, low, "AvgADX :" + AvgADX, Color.gray, yes);

####

# Squeeze condition
#def sqz3 = if squeezeval != 0 and squeezeval[1] != 0 and squeezeval[2] != 0 then 1 else 0;
def sqzvalue = Sum(squeezeval, 5);
##AddChartBubble(sqzvalue > 0, low, "sqz :" + sqzvalue, Color.cyan, yes);
def sqz3 = if sqzvalue > 0 and squeezeval == 0 then 1 else 0;
def Close_pos = if sqzvalue > 2 OR OSCILLATOR CROSSES 0 then 1 else 0;

##AddChartBubble(YES, low, "sqz3 :" + Sum(squeezeval[1], 2), Color.cyan, yes);
def fire_begin = if squeezeval > 0 AND squeezeval[1] == 0 then 1 else 0 ;
#AddChartBubble(fire_begin == 1 , low, "Fire/Sqz :" + "Begins " + squeezeval, Color.magenta, yes);
def fire_progressc = if squeezeval > 0 AND squeezeval[1] > 0 then 1 else 0 ;
def fire_progress = if fire_progressc == 1 AND fire_progressc[1] != 1 then 1 else 0 ;
#AddChartBubble(fire_progress == 1 , low, "Fire/Sqz :" + "Progress " + squeezeval, Color.magenta, yes);
def fire_endc = if squeezeval == 0 AND squeezeval[1] > 0 then 1 else 0 ;
def fire_end = if fire_endc == 1 AND fire_endc[1] != 1 then 1 else 0 ;
#AddChartBubble(fire_end == 1 , low, "Fire/Sqz :" + "Ends", Color.magenta, yes);
def fire = if squeezeval[0] == 0 and sqzvalue > 2 then 1 else 0;
#AddChartBubble(fire == 1 and fire[1] != 1 , low, "Fire/Sqz :" + "Trade", Color.magenta, yes);


#addLabel(fire_begin == 1 , "FIRE: " + "Begins" + sqzvalue, color.MAGENTA);
#addLabel(fire_progressc == 1, "FIRE: " + "Progress " + sqzvalue, color.magenta);
#addLabel(fire_end == 1, "FIRE: " + " Ends " + sqzvalue, color.magenta);
#addLabel(fire == 1, "FIRE: " + "Trade - check conditions " + sqzvalue, color.magenta);



#cONDITIONS
def c1B = if low > a3 and high > a3 then 1 else 0 ;
def c1S = if low < a3 and high < a3 then 1 else 0 ;
def c2B = if c1B == 1 and bzone == 1 then 1 else 0; ;
def c2S = if c1S == 1 and szone == 1 then 1 else 0;
def c3B = if price > a5 then 1 else 0; # 55 Length
def c3S = if price < a5 then 1 else 0; # 55 Length
def c4B = if price > a8 then 1 else 0; # 200 Length
def c4S = if price < a8 then 1 else 0; # 200 Length
def c5B = if price > TrailingStop then 1 else 0;
def c5S = if price < TrailingStop then 1 else 0;
def c6 = if oscillator crosses 0 then 1 else 0;



def fire5up = if fire == 1 and c5B == 1 and bzone == 1 then 1 else 0;
def fire5dn = if fire == 1 and c5S == 1 and szone == 1 then 1 else 0;
##AddChartBubble(fire5up == 1 and fire5up[1] != 1, low, "fire5up :" + "Upward Fire", Color.white, yes);
##AddChartBubble(fire5dn == 1 and fire5dn[1] != 1, low, "fire5Dn :" + "Dnward Fire", Color.white, yes);

##AddChartBubble(yes, low, "price :" + price, Color.white, yes);
##AddChartBubble(yes, low, "TrailingStop :" + TrailingStop, Color.white, yes);
# buy condition
def b1 = if C1B == 1 and C2b == 1 and c5B == 1 and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b2 = if bPLUS == 1 and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b3 = if fire5up == 1 and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b4 = if price > TrailingStop and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
def b5 = if (aPlus == 1 OR bPLUS == 1 OR CPLUS == 1 ) and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
##AddChartBubble(b4 == 1, low, "price :" + price, Color.green, yes);
##AddChartBubble(b4 == 1, low, "TrailingStop :" + TrailingStop, Color.green, yes);
##AddChartBubble(yes, low, "b1 :" + b1, Color.green, yes);
##AddChartBubble(yes, low, "b2 :" + b2, Color.green, yes);
##AddChartBubble(yes, low, "b3 :" + b3, Color.green, yes);
##AddChartBubble(yes, low, "b4 :" + b4, Color.green, yes);


def bSignal = if b1 == 1 OR b2 == 1 or b3 == 1 or b4 == 1
OR B5 == 1
then 1 else 0;
##AddChartBubble( bSignal == 1 , low, "Long Signal" , Color.green, yes);
def buy = if bSignal == 1 and bSignal[1] != 1 then 1 else 0 ;
##AddChartBubble( buy == 1 , low, "Buy: " + close, Color.green, yes);
#AddChartBubble(buy == 1 , low, "Long/Buy" , Color.green, yes);
plot BuypLOT = if buy == 1
then LOW else DOUBle.NaN;
BuypLOT.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
BuypLOT.SetLineWeight(5);
BuypLOT.SetDefaultColor(Color.green);

##AddChartBubble(buy == 1, low, "price :" + price, Color.green, yes);
##AddChartBubble(buy == 1, low, "TrailingStop :" + TrailingStop, Color.green, yes);
##AddChartBubble(buy == 1, low, "b1 :" + b1, Color.green, yes);
##AddChartBubble(buy == 1, low, "b2 :" + b2, Color.green, yes);
##AddChartBubble(buy == 1, low, "b3 :" + b3, Color.green, yes);
##AddChartBubble(buy == 1, low, "b4 :" + b4, Color.green, yes);

# Sell condition
def s1 = if C1S == 1 and C2S == 1 and c5S == 1 and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def s2 = if bMINUS == 1 and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def s3 = if fire5dn == 1 and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def s4 = if price < TrailingStop and OSC_DN_IND == 1 and szone == 1 then 1 else 0;
def S5 = if (aMINUS == 1 OR bMINUS == 1 OR CMINUS == 1) and OSC_UP_IND == 1 and bzone == 1 then 1 else 0;
##AddChartBubble(szone == 1, low, "price :" + price, Color.red, yes);
##AddChartBubble(szone == 1, low, "TrailingStop :" + TrailingStop, Color.red, yes);
def SSignal = if s1 == 1 or s2 == 1 or s3 == 1 or s4 == 1
OR S5 == 1
then 1 else 0;
##AddChartBubble( SSignal == 1 , low, "Short Signal" , Color.red, yes);
def sell = if sSignal == 1 and sSignal[1] != 1 then 1 else 0;
##AddChartBubble(sell , low, "Sell: " + close, Color.red, yes);
#AddChartBubble(sell , low, "Short/Sell" , Color.red, yes);

def sELLLOT = if buy == 1
then LOW else DOUBle.NaN;
#sELLLOT.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#sELLLOT.SetLineWeight(5);
#sELLLOT.SetDefaultColor(Color.rED);

# Close buy condition
Def b1s = if SSignal == 1 or fire_begin == 1
#szone == 1 or Close_pos == 1 OR ( OSC_DN_IND == 1 )
#or close_zone == 1
#AND (CLOSE < A5 OR CLOSE < TrailingStop OR SQZ3 )
THEN 1 ELSE 0;
##AddChartBubble(b1s == 1 , low, "szone: " + szone , Color.light_red, yes);
Def b2s = if SSignal == 1
#OR TTMHI_DN == 1 OR c6 == 1
THEN 1 ELSE 0;

Def buyclose_Signal1 = IF b1s == 1 OR B2S == 1 or sqz3 == 1 THEN 1 ELSE 0;
Def buyclose_Signal = IF buyclose_Signal1 == 1 and bSignal != 1 THEN 1 ELSE 0;
##AddChartBubble(buyclose_Signal == 1 and buyclose_Signal[1] != 1 , low, "Buy Close: " + close, Color.light_red, yes);

#AddChartBubble(buyclose_Signal == 1 and buyclose_Signal[1] != 1 , low, "BC: " , Color.light_red, yes);

def BuyClosepLOT = if buyclose_Signal == 1 and buyclose_Signal[1] != 1
then LOW else DOUBle.NaN;
#BuyClosepLOT.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#BuyClosepLOT.SetLineWeight(5);
#BuyClosepLOT.SetDefaultColor(Color.LIGHT_rED);



###
##AddChartBubble(buy == 1 , low, "AVGhiPCNT: " + TTMHI_uP_CNT_AVG, Color.LIGHT_GREEN, yes);
##AddChartBubble(sell == 1 , low, "hiPNCNT: " + TTMHI_DN_CNT_AVG, Color.LIGHT_rED, yes);
###


# Close Sell condition
Def S1s = IF bSignal == 1 or fire_begin == 1
#or bzone == 1 or Close_pos == 1 OR OSC_UP_IND == 1
# or close_zone == 1
#AND (CLOSE > A5 OR CLOSE > TrailingStop OR SQZ3 )
THEN 1 ELSE 0;
Def S2s = IF BSignal == 1
#OR TTMHI_UP == 1 OR c6 == 1 or sqz3 == 1
THEN 1 ELSE 0;
Def Sellclose_Signal1 = IF s1s OR S2s == 1 or sqz3 == 1 THEN 1 ELSE 0;
Def Sellclose_Signal = IF Sellclose_Signal1 == 1 and SSignal != 1 THEN 1 ELSE 0;
##AddChartBubble(Sellclose_Signal == 1 and Sellclose_Signal[1] != 1 , low, "Sell Close: " + close, Color.light_green, yes);

#AddChartBubble(Sellclose_Signal == 1 and Sellclose_Signal[1] != 1 , low, "SC" , Color.light_green, yes);

def SellCoverLOT = if Sellclose_Signal == 1 and Sellclose_Signal[1] != 1
then LOW else DOUBle.NaN;
#SellCoverLOT.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#SellCoverLOT.SetLineWeight(5);
#SellCoverLOT.SetDefaultColor(Color.LIGHT_green);


#
# Assigning color and labels based on conditions
#addLabel(yes, if bSignal == 1 then "B" else if SSignal == 1 then "S" else if buyclose_Signal1 == 1 then "BC" else if Sellclose_Signal1 == 1 then "SC" else "",
# if bSignal == 1 then
# if bSignal[1] == bSignal then Color.GRAY else #Color.GREEN
# else if SSignal == 1 then
# if SSignal[1] == SSignal then Color.GRAY else #Color.RED
# else if buyclose_Signal1 == 1 then
# if buyclose_Signal1[1] == buyclose_Signal1 then #Color.GRAY else Color.LIGHT_RED
# else if Sellclose_Signal1 == 1 then
# if Sellclose_Signal1[1] == Sellclose_Signal1 then #Color.GRAY else Color.LIGHT_GREEN
# else
# Color.WHITE # Default color if none of the #conditions are met
#);

# If you also want to plot points with colors
#plot pvalue = Double.NaN; # Initializing plot with no value
#pvalue.SetPaintingStrategy(PaintingStrategy.POINTS);
#pvalue.AssignValueColor(if bSignal == 1 then if bSignal[1] == bSignal then Color.GRAY else Color.GREEN else if SSignal == 1 then if SSignal[1] == SSignal then Color.GRAY else Color.RED else if buyclose_Signal1 == 1 then if buyclose_Signal1[1] == #buyclose_Signal1 then Color.GRAY else Color.LIGHT_RED else if Sellclose_Signal1 == 1 then if Sellclose_Signal1[1] == Sellclose_Signal1 then Color.GRAY else Color.LIGHT_GREEN else Color.WHITE);
#Raaz_20231227_TTM_Plot_Buy

Bst
Raj

Sorry, but TOS will likely not allow this to be used as a scan or watchlist. The number of lines appears not to be the problem, but the complexiity of the code in those lines. Often with a complex indicator like this, the amount of processing time would impact the whole TOS platform.

I tried eliminating unnecessary code, including more that just the commented out code in your post. When copying this into the scanner, a fatal complexity message appeared. Also, the workaround scan method of referencing the study name (exmple: buysqueeze().buy) produced the fatal message.
 
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
rvaidyamath TTM Squeeze scan not working Questions 2
J Find slope of TTM Lrc Questions 2
rvaidyamath TTM Help Questions 1
markallenwilson1016 TTM Pro v. TTM Triple Squeeze Questions 1
luiscervantes30 ttm. pro dashboard? Questions 2

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
445 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top