How do I scan for this kind of over extended stock?

image.png


how do i scan for stock

short :
high outside 2 std dev of bollinger band + 4 ATR up in less than 5 days

long :
low outside 2 std dev of bolloging band + 4 ATR down in less than 5 days

any help with this ?
thanks in advance.

mean reversion play

Code:
#short version
#BB
input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.Simple;

def sDev = stdev(data = price[-displace], length = length);

def MidLine = MovingAverage(averageType, data = price[-displace], length = length);
def LowerBand = MidLine + num_Dev_Dn * sDev;
def UpperBand = MidLine + num_Dev_Up * sDev;


#ATR

def ATR = MovingAverage(AverageType.WILDERS, TrueRange(high, close, low), 14);

plot scan = high[1]> upperband[1] and close/close[5] > 4*ATR ;



#longversion

#BB
input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.Simple;

def sDev = stdev(data = price[-displace], length = length);

def MidLine = MovingAverage(averageType, data = price[-displace], length = length);
def LowerBand = MidLine + num_Dev_Dn * sDev;
def UpperBand = MidLine + num_Dev_Up * sDev;


#ATR

def ATR = MovingAverage(AverageType.WILDERS, TrueRange(high, close, low), 14);

plot scan = low[1]< lowerband[1] and close/close[5] > 4*ATR ;

not sure if i'm getting the code right. but seem like it. anybody would like to try it out? or improve?
 
Solution
Hi JJ, this script places a blue arrow for long signals and a red one for short signals. See chart below.

The Bollinger bands' parameters can be adjusted in the inputs and the ATR multiple (default is 4) and number of days ago (default = 5) are adjustable as well.

Set Long to be True in the stock scanner to scan for buy signals. Set Short to be True to scan for sell signals.

Code:
# ATRplusBBs_Scan
# question from JJJJJJ11111 - scanner for stocks, e.g., long signals when low is below the lower Bollinger band and close has decreased by 4 times the ATR in the last 5 price bars.

input price = close;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_Up = 2.0;
input averageType = AverageType.SIMPLE;
input atrlength = 14;
input...
Hi JJ, this script places a blue arrow for long signals and a red one for short signals. See chart below.

The Bollinger bands' parameters can be adjusted in the inputs and the ATR multiple (default is 4) and number of days ago (default = 5) are adjustable as well.

Set Long to be True in the stock scanner to scan for buy signals. Set Short to be True to scan for sell signals.

Code:
# ATRplusBBs_Scan
# question from JJJJJJ11111 - scanner for stocks, e.g., long signals when low is below the lower Bollinger band and close has decreased by 4 times the ATR in the last 5 price bars.

input price = close;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_Up = 2.0;
input averageType = AverageType.SIMPLE;
input atrlength = 14;
input averageType2 = AverageType.WILDERS;
input offset = 5;
input ATRmultiple = 4;

def sDev = stdev(data = price, length = length);
def MidLine = MovingAverage(averageType, data = price, length = length);
def LowerBand = MidLine + num_Dev_Dn * sDev;
def UpperBand = MidLine + num_Dev_Up * sDev;

def ATR = MovingAverage(averageType2, TrueRange(high, close, low), atrlength);

plot Long = low < LowerBand and close <= (close[offset] - (ATR[offset] * ATRmultiple));

plot Short = high > UpperBand and close > (close[offset] + (ATR[offset] * ATRmultiple));

Long.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Long.SetDefaultColor(Color.BLUE);
Long.SetLineWeight(4);
Short.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Short.SetDefaultColor(Color.RED);
Short.SetLineWeight(4);


JJJJJJ11111-chart-3-29-23.png
 
Solution

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

Thread starter Similar threads Forum Replies Date
S scan help for relative volume Questions 0
A Engulfing Candle Scan Questions 0
D Power X Scan Questions 0
A Bull/Bear 180 Scan Questions 0
T 3 day low and 8 day low scan Questions 0

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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