Need a column in watchlist denoting Price(close) is between 18 EMA and 24 EMA

GreenGuru

New member
Newbie with code

def EMA19 = expAverage(close,19);
def EMA21 = expAverage(close,21);
def EMA23 = expAverage(close,23);

plot output =EMA19 > close and close < EMA23;
 
Solution
def EMA19 = ExpAverage(19);
def EMA21 = ExpAverage(21);
def EMA23 = ExpAverage(23);

plot scan = Between(close, EMA19, EMA23);

https://github.com/ConnorSmiley/UseThinkScript/blob/main/EMA19 between EMA23

@moxiesmiley
using between() , only works when the 2nd parameter is less than the 3rd.
plot scan = Between(close, EMA19, EMA23);

if ema19 is greater than ema23, then it won't work, it will never be true, even if close is between the values.
for this to always work, min and max would have to be added.

plot scan = Between(close, min(EMA19, EMA23) , max(EMA19, EMA23));
Thanks! It worked.
is there a way to see if the current price is between 19 and 23 Daily EMA. I think currently its showing the previous day's close price?
possible?
 
def EMA19 = ExpAverage(19);
def EMA21 = ExpAverage(21);
def EMA23 = ExpAverage(23);

plot scan = Between(close, EMA19, EMA23);

https://github.com/ConnorSmiley/UseThinkScript/blob/main/EMA19 between EMA23

@moxiesmiley
using between() , only works when the 2nd parameter is less than the 3rd.
plot scan = Between(close, EMA19, EMA23);

if ema19 is greater than ema23, then it won't work, it will never be true, even if close is between the values.
for this to always work, min and max would have to be added.

plot scan = Between(close, min(EMA19, EMA23) , max(EMA19, EMA23));
 
Solution
@moxiesmiley
using between() , only works when the 2nd parameter is less than the 3rd.
plot scan = Between(close, EMA19, EMA23);

if ema19 is greater than ema23, then it won't work, it will never be true, even if close is between the values.
for this to always work, min and max would have to be added.

plot scan = Between(close, min(EMA19, EMA23) , max(EMA19, EMA23));
Thanks, I didn't know. Theres no mention in the Thinkscript documentation. Its rubbish.
 
How do I add this to a scan. Below would work?

def EMA19 = ExpAverage(19);
def EMA21 = ExpAverage(21);
def EMA23 = ExpAverage(23);
plot scan = Between(close, min(EMA19, EMA23) , max(EMA19, EMA23));
Can anyone help with this.
This is giving me a list. But the stocks are not trading between their 19 and 23 EMA. Any idea how I can make this to work

1. I want to find the stocks trading close to their 21EMA on a DAILY
2. I want it to run multiple times a day so that it can alert me. because that's my entry point. So essentially a) Find daily 21 EMA value. say 100 b) on a 15 min price close is between the calculated daily EMA value(98-102)

much appreciated
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
361 Online
Create Post

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