Bullish and Bearish Scanner

Lds3435

New member
Hi,

Trying to create a scanner with this condition:

Bullish:

low is above the 21 day EMA for a least 10 days
21 day EMA is above the 50 day SMA for at least 5 days
50 day SMA is in an uptrend
close up for the day

Bearish:

21 day EMA crosses under 50 SMA
Close 10% below recent high and below the 50 day SMA


Thank you much!
 
Solution
Hi,

Trying to create a scanner with this condition:

Bullish:

low is above the 21 day EMA for a least 10 days
21 day EMA is above the 50 day SMA for at least 5 days
50 day SMA is in an uptrend
close up for the day

Bearish:

21 day EMA crosses under 50 SMA
Close 10% below recent high and below the 50 day SMA


Thank you much!

here is an upper study for you to experiment with.
it draws vertical lines for bull and bear signals

for bear, at 10%, i never saw any bear signals. i changed it to 0.5% to be able to see some signals. with a cross below AND a big drop, it is highly unlikely to work at 10%.


to use as a scan , ( or as a lower for testing) , add

plot z1 = bull;
or
plot z2 = bear;

and disable the existing plots with...
Hi,

Trying to create a scanner with this condition:

Bullish:

low is above the 21 day EMA for a least 10 days
21 day EMA is above the 50 day SMA for at least 5 days
50 day SMA is in an uptrend
close up for the day

Bearish:

21 day EMA crosses under 50 SMA
Close 10% below recent high and below the 50 day SMA


Thank you much!

here is an upper study for you to experiment with.
it draws vertical lines for bull and bear signals

for bear, at 10%, i never saw any bear signals. i changed it to 0.5% to be able to see some signals. with a cross below AND a big drop, it is highly unlikely to work at 10%.


to use as a scan , ( or as a lower for testing) , add

plot z1 = bull;
or
plot z2 = bear;

and disable the existing plots with #


Code:
# avg_bullbear_scan_00

#https://usethinkscript.com/threads/bullish-and-bearish-scanner.14164/
#Bullish and Bearish Scanner
# Lds3435   1/22

#Trying to create a scanner with this condition:

#Bullish:

#low is above the 21 day EMA for a least 10 days
#21 day EMA is above the 50 day SMA for at least 5 days
#50 day SMA is in an uptrend
#close up for the day


#Bearish:

#21 day EMA crosses under 50 SMA
#Close 10% below recent high and below the 50 day SMA



#------------

def na = double.nan;
def bn = barnumber();
def lastbar = !isnan(close[0]) and isnan(close[-1]);

input duration1_bars = 10;
input duration2_bars = 5;

def price = close;

input ma1_len = 21;
input ma1_type =  AverageType.EXPONENTIAL;
def ma1 = MovingAverage(ma1_type, price, ma1_len);

input ma2_len = 50;
input ma2_type =  AverageType.simple;
def ma2 = MovingAverage(ma2_type, price, ma2_len);


#-----------------------

# bull
#low is above the 21 day EMA for a least 10 days
#21 day EMA is above the 50 day SMA for at least 5 days
#50 day SMA is in an uptrend
#close up for the day

def bull1 = sum((low > ma1), duration1_bars) == duration1_bars;
def bull2 = sum((ma1 > ma2), duration2_bars) == duration2_bars;
def bull3 = ma2 > ma2[1];
def bull4 = close > close[1];

def bull = bull1 and bull2 and bull3 and bull4;


#Bearish:

#21 day EMA crosses under 50 SMA
#Close 10% below recent high and below the 50 day SMA

input per = 0.5;
def bear1 = ma1 crosses below ma2;
def bear2 = (close < ((1 - (per/100))*high[1]) and close < ma2);

def bear = bear1 and bear2;


# ---------------------

input show_vertical_lines = yes;
addverticalline(show_vertical_lines and bull, "-", color.green);
addverticalline(show_vertical_lines and bear, "-", color.red);

#------------------
input show_average_lines = yes;

plot z1 = if show_average_lines then ma1 else na;
z1.setdefaultcolor(getcolor(1));
#z1.setlineweight(1);
z1.hidebubble();

plot z2 = if show_average_lines then ma2 else na;
z2.setdefaultcolor(getcolor(2));
#z2.setlineweight(1);
z2.hidebubble();

#
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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