Squeeze watchlist

Golferdave

New member
I have a code for the squeeze with an arrow green for long and red for short. How can I create a watchlist or scan to show up with a stock show the arrow? Hope that makes sense

Code:
#Momentum Indicator

input length = 13;
input AvgMomentumLength = 13;
input price = close;
input AverageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

assert(length > 0, "'length' must be positive: " + length);


def Momentum = price - price[length];
plot AvgMomentum = movavgExponential(Momentum, AvgMomentumLength);

def bullishMomentum = AvgMomentum > 0;
def bearishMomentum = AvgMomentum < 0;

AvgMomentum.SetPaintingStrategy(paintingstrategy.LINE);
AvgMomentum.SetLineWeight(3);
AvgMomentum.AssignValueColor(if bullishmomentum then color.blue else if bearishMomentum then color.red else color.black);


# Squeeze Checklist Signals

def EMA8 = movavgExponential(close,8);
def EMA21 = movavgExponential(close,21);

def bullishStack = EMA8 > EMA21;
def bearishStack = EMA8 < EMA21;

#RSI
def RSIlength = 14;
def RSIover_Bought = 70;
def RSIover_Sold = 30;
def RSIprice = close;
def RSIaverageType = AverageType.WILDERS;

def NetChgAvg = MovingAverage(RSIaverageType, RSIprice - RSIprice[1], RSIlength);
def TotChgAvg = MovingAverage(RSIaverageType, AbsValue(RSIprice - RSIprice[1]), RSIlength);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def RSIOverSold = RSIover_Sold;
def RSIOverBought = RSIover_Bought;
def RSIUpSignal = if RSI crosses above RSIOverSold then RSIOverSold else Double.NaN;
def RSIDownSignal = if RSI crosses below RSIOverBought then RSIOverBought else Double.NaN;
def RSImidline = 50;

def bullishRSI = RSI >= 50;
def bearishRSI = RSI < 50;

#Stochastics
def over_bought = 80;
def over_sold = 20;
def KPeriod = 14;
def DPeriod = 3;
def priceH = high;
def priceL = low;
def priceC = close;
def slowing_period = 3;
def averageTypeStoch = AverageType.SIMPLE;

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def FullK = MovingAverage(averageTypeStoch, FastK, slowing_period);
def FullD = MovingAverage(averageTypeStoch, FullK, DPeriod);

def OverBought = over_bought;
def OverSold = over_sold;
def MidLine = 50;

def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;

def bullishStoch = FullK > FullD;
def bearishStoch = FullK < FullD;

# SqueezeHistogram

def squeezehistogram = TTM_Squeeze(close, 20, 1.5, 2.0, 1.0).Histogram;

def squeezehistogramUP = squeezehistogram > squeezehistogram[1] and squeezehistogram[1] > squeezehistogram[2];
def squeezehistogramDOWN = squeezehistogram < squeezehistogram[1] and squeezehistogram[1] < squeezehistogram[2];


# Squeeze Signal

def normalSqueeze = if TTM_Squeeze(close, 20, 1.5, 2.0, 1.0).SqueezeAlert == 0 then 1 else 0;
def aggroSqueeze = if TTM_Squeeze(close, 20, 2.0, 2.0, 1.0).SqueezeAlert == 0 then 1 else 0;

plot squeezeSignal = normalSqueeze or aggroSqueeze;
squeezeSignal.setPaintingStrategy(paintingStrategy.POINTS);
squeezeSignal.setLineWeight(3);

squeezeSignal.AssignValueColor(if normalSqueeze then color.yellow else if aggroSqueeze then color.yellow else color.dark_gray);

def BullishSignal = squeezeSignal and bullishstack and bullishRSI and bullishStoch and squeezehistogramUP;
def BearishSignal = squeezeSignal and bearishstack and bearishRSI and bearishStoch and squeezehistogramDOWN;

plot BullishSignal2 = if bullishsignal and !bullishsignal[1] then avgmomentum else double.nan;
plot BearishSignal2 =  if bearishsignal and !bearishsignal[1] then avgmomentum else double.nan;

BullishSignal2.SetpaintingStrategy(PaintingStrategy.ARROW_UP);
BearishSignal2.SetpaintingStrategy(PaintingStrategy.ARROW_DOWN);

BullishSignal2.SetLineWeight(2);
BearishSignal2.SetlineWeight(2);

BullishSignal2.SetdefaultColor(color.green);
BearishSignal2.SetdefaultColor(color.red);

# End Code
 
Last edited by a moderator:
Solution
I have a code for the squeeze with an arrow green for long and red for short. How can I create a watchlist or scan to show up with a stock show the arrow? Hope that makes sense

Code:
#Momentum Indicator

input length = 13;
input AvgMomentumLength = 13;
input price = close;
input AverageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

assert(length > 0, "'length' must be positive: " + length);


def Momentum = price - price[length];
plot AvgMomentum = movavgExponential(Momentum, AvgMomentumLength);

def bullishMomentum = AvgMomentum > 0;
def bearishMomentum = AvgMomentum < 0;

AvgMomentum.SetPaintingStrategy(paintingstrategy.LINE);
AvgMomentum.SetLineWeight(3);
AvgMomentum.AssignValueColor(if bullishmomentum then...

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

I have a code for the squeeze with an arrow green for long and red for short. How can I create a watchlist or scan to show up with a stock show the arrow? Hope that makes sense

Code:
#Momentum Indicator

input length = 13;
input AvgMomentumLength = 13;
input price = close;
input AverageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

assert(length > 0, "'length' must be positive: " + length);


def Momentum = price - price[length];
plot AvgMomentum = movavgExponential(Momentum, AvgMomentumLength);

def bullishMomentum = AvgMomentum > 0;
def bearishMomentum = AvgMomentum < 0;

AvgMomentum.SetPaintingStrategy(paintingstrategy.LINE);
AvgMomentum.SetLineWeight(3);
AvgMomentum.AssignValueColor(if bullishmomentum then color.blue else if bearishMomentum then color.red else color.black);


# Squeeze Checklist Signals

def EMA8 = movavgExponential(close,8);
def EMA21 = movavgExponential(close,21);

def bullishStack = EMA8 > EMA21;
def bearishStack = EMA8 < EMA21;

#RSI
def RSIlength = 14;
def RSIover_Bought = 70;
def RSIover_Sold = 30;
def RSIprice = close;
def RSIaverageType = AverageType.WILDERS;

def NetChgAvg = MovingAverage(RSIaverageType, RSIprice - RSIprice[1], RSIlength);
def TotChgAvg = MovingAverage(RSIaverageType, AbsValue(RSIprice - RSIprice[1]), RSIlength);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def RSIOverSold = RSIover_Sold;
def RSIOverBought = RSIover_Bought;
def RSIUpSignal = if RSI crosses above RSIOverSold then RSIOverSold else Double.NaN;
def RSIDownSignal = if RSI crosses below RSIOverBought then RSIOverBought else Double.NaN;
def RSImidline = 50;

def bullishRSI = RSI >= 50;
def bearishRSI = RSI < 50;

#Stochastics
def over_bought = 80;
def over_sold = 20;
def KPeriod = 14;
def DPeriod = 3;
def priceH = high;
def priceL = low;
def priceC = close;
def slowing_period = 3;
def averageTypeStoch = AverageType.SIMPLE;

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def FullK = MovingAverage(averageTypeStoch, FastK, slowing_period);
def FullD = MovingAverage(averageTypeStoch, FullK, DPeriod);

def OverBought = over_bought;
def OverSold = over_sold;
def MidLine = 50;

def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;

def bullishStoch = FullK > FullD;
def bearishStoch = FullK < FullD;

# SqueezeHistogram

def squeezehistogram = TTM_Squeeze(close, 20, 1.5, 2.0, 1.0).Histogram;

def squeezehistogramUP = squeezehistogram > squeezehistogram[1] and squeezehistogram[1] > squeezehistogram[2];
def squeezehistogramDOWN = squeezehistogram < squeezehistogram[1] and squeezehistogram[1] < squeezehistogram[2];


# Squeeze Signal

def normalSqueeze = if TTM_Squeeze(close, 20, 1.5, 2.0, 1.0).SqueezeAlert == 0 then 1 else 0;
def aggroSqueeze = if TTM_Squeeze(close, 20, 2.0, 2.0, 1.0).SqueezeAlert == 0 then 1 else 0;

plot squeezeSignal = normalSqueeze or aggroSqueeze;
squeezeSignal.setPaintingStrategy(paintingStrategy.POINTS);
squeezeSignal.setLineWeight(3);

squeezeSignal.AssignValueColor(if normalSqueeze then color.yellow else if aggroSqueeze then color.yellow else color.dark_gray);

def BullishSignal = squeezeSignal and bullishstack and bullishRSI and bullishStoch and squeezehistogramUP;
def BearishSignal = squeezeSignal and bearishstack and bearishRSI and bearishStoch and squeezehistogramDOWN;

plot BullishSignal2 = if bullishsignal and !bullishsignal[1] then avgmomentum else double.nan;
plot BearishSignal2 =  if bearishsignal and !bearishsignal[1] then avgmomentum else double.nan;

BullishSignal2.SetpaintingStrategy(PaintingStrategy.ARROW_UP);
BearishSignal2.SetpaintingStrategy(PaintingStrategy.ARROW_DOWN);

BullishSignal2.SetLineWeight(2);
BearishSignal2.SetlineWeight(2);

BullishSignal2.SetdefaultColor(color.green);
BearishSignal2.SetdefaultColor(color.red);

# End Code


here is a watchlist study
set to 5 min

zsqz_colors
http://tos.mx/!m7T9Etq4

i tend to start my list study names with a z so they are grouped together, at the end of the list.

it shows 4 colors and 4 words. thi way similar signals are sorted together
CYAN "1 rising" a blue line and rising
GREEN "2 UP" an up arrow
RED "3 DOWN" a down arrow
YELLOW "4 falling" a red line and dropping


i changed the last plot , into 2 more formulas, making boolean formulas.
def bullx = bullishsignal and !bullishsignal[1];
def bearx = bearishsignal and !bearishsignal[1];


Code:
#sqz_colors
#sqz_watchlist_colors_col

#https://usethinkscript.com/threads/squeeze-watchlist.20417/
#Squeeze watchlist
#Golferdave  2/7

#I have a code for the squeeze with an arrow green for long and red for short. How can I create a watchlist or scan to show up with a stock show the arrow? Hope that makes sense


#Momentum Indicator

declare lower;

def na = double.nan;

input length = 13;
input AvgMomentumLength = 13;
input price = close;
input AverageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

#assert(length > 0, "'length' must be positive: " + length);


def Momentum = price - price[length];
#plot AvgMomentum = movavgExponential(Momentum, AvgMomentumLength);
def AvgMomentum = movavgExponential(Momentum, AvgMomentumLength);
def bullishMomentum = AvgMomentum > 0;
def bearishMomentum = AvgMomentum < 0;

#AvgMomentum.SetPaintingStrategy(paintingstrategy.LINE);
#AvgMomentum.SetLineWeight(3);
#AvgMomentum.AssignValueColor(if bullishmomentum then color.blue else if bearishMomentum then color.red else color.black);


# Squeeze Checklist Signals

def EMA8 = movavgExponential(close,8);
def EMA21 = movavgExponential(close,21);

def bullishStack = EMA8 > EMA21;
def bearishStack = EMA8 < EMA21;

#RSI
def RSIlength = 14;
def RSIover_Bought = 70;
def RSIover_Sold = 30;
def RSIprice = close;
def RSIaverageType = AverageType.WILDERS;

def NetChgAvg = MovingAverage(RSIaverageType, RSIprice - RSIprice[1], RSIlength);
def TotChgAvg = MovingAverage(RSIaverageType, AbsValue(RSIprice - RSIprice[1]), RSIlength);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def RSIOverSold = RSIover_Sold;
def RSIOverBought = RSIover_Bought;
def RSIUpSignal = if RSI crosses above RSIOverSold then RSIOverSold else Double.NaN;
def RSIDownSignal = if RSI crosses below RSIOverBought then RSIOverBought else Double.NaN;
def RSImidline = 50;

def bullishRSI = RSI >= 50;
def bearishRSI = RSI < 50;

#Stochastics
def over_bought = 80;
def over_sold = 20;
def KPeriod = 14;
def DPeriod = 3;
def priceH = high;
def priceL = low;
def priceC = close;
def slowing_period = 3;
def averageTypeStoch = AverageType.SIMPLE;

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def FullK = MovingAverage(averageTypeStoch, FastK, slowing_period);
def FullD = MovingAverage(averageTypeStoch, FullK, DPeriod);

def OverBought = over_bought;
def OverSold = over_sold;
def MidLine = 50;

def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;

def bullishStoch = FullK > FullD;
def bearishStoch = FullK < FullD;

# SqueezeHistogram

def squeezehistogram = TTM_Squeeze(close, 20, 1.5, 2.0, 1.0).Histogram;

def squeezehistogramUP = squeezehistogram > squeezehistogram[1] and squeezehistogram[1] > squeezehistogram[2];
def squeezehistogramDOWN = squeezehistogram < squeezehistogram[1] and squeezehistogram[1] < squeezehistogram[2];


# Squeeze Signal

def normalSqueeze = if TTM_Squeeze(close, 20, 1.5, 2.0, 1.0).SqueezeAlert == 0 then 1 else 0;
def aggroSqueeze = if TTM_Squeeze(close, 20, 2.0, 2.0, 1.0).SqueezeAlert == 0 then 1 else 0;

plot squeezeSignal = normalSqueeze or aggroSqueeze;
squeezeSignal.setPaintingStrategy(paintingStrategy.POINTS);
squeezeSignal.setLineWeight(3);

squeezeSignal.AssignValueColor(if normalSqueeze then color.yellow else if aggroSqueeze then color.yellow else color.dark_gray);

def BullishSignal = squeezeSignal and bullishstack and bullishRSI and bullishStoch and squeezehistogramUP;
def BearishSignal = squeezeSignal and bearishstack and bearishRSI and bearishStoch and squeezehistogramDOWN;

#plot BullishSignal2 = if bullishsignal and !bullishsignal[1] then avgmomentum else double.nan;
#plot BearishSignal2 =  if bearishsignal and !bearishsignal[1] then avgmomentum else double.nan;
def bullx = bullishsignal and !bullishsignal[1];
def bearx = bearishsignal and !bearishsignal[1];

#plot BullishSignal2 = if bullx then avgmomentum else na;
#plot BearishSignal2 = if bearx then avgmomentum else na;
#BullishSignal2.SetpaintingStrategy(PaintingStrategy.ARROW_UP);
#BearishSignal2.SetpaintingStrategy(PaintingStrategy.ARROW_DOWN);
#BullishSignal2.SetLineWeight(2);
#BearishSignal2.SetlineWeight(2);
#BullishSignal2.SetdefaultColor(color.green);
#BearishSignal2.SetdefaultColor(color.red);


# End Code


#addchartbubble(0, -1,
#(if bullx then "UP" else if bearx then "DOWN" else "---"),
#color.yellow, no);
#(if bullx then color.green else if bearx then color.red
# else if bullishmomentum then color.cyan else if bearishMomentum then color.yellow
# else color.gray),
# no);

addlabel(1,
(     if bullx then "2  UP"
 else if bearx then "3 DOWN"
 else if bullishmomentum then "1 rising" 
 else if bearishMomentum then "4 falling" 
 else "---"),
color.black, no);


AssignBackgroundColor(if bullx then color.green else if bearx then color.red
 else if bullishmomentum then color.cyan else if bearishMomentum then color.yellow
 else color.gray);
#
 

Attachments

  • 00c-1.JPG
    00c-1.JPG
    46 KB · Views: 81
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
363 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