# inside days with closes above the 8ema

#### Rag\$

##### New member
I am having issues with the correct coding of a scan i am trying to build. On a daily timeframe i am wanting to scan for inside days with closes above the 8ema, can someone please help? I found this for the inside day...

# Inside and Outside Bar
# Mobius
# 8.7.2017

def inside = high < high[1] and low > low[1];
plot signal = inside within 1 bars;

And this is what i am using for above the 8ema

input ema_length = 8;
def ema = ExpAverage(close[1], length=ema_length);

plot signal = close > ema && open < ema;

but its not providing the right results. Any help would be really appreciated..>This is my first attempt at writing a scan and has been really difficult so any help would be really appreciated!

Solution
I am having issues with the correct coding of a scan i am trying to build. On a daily timeframe i am wanting to scan for inside days with closes above the 8ema, can someone please help? I found this for the inside day...

# Inside and Outside Bar
# Mobius
# 8.7.2017

def inside = high < high[1] and low > low[1];
plot signal = inside within 1 bars;

And this is what i am using for above the 8ema

input ema_length = 8;
def ema = ExpAverage(close[1], length=ema_length);

plot signal = close > ema && open < ema;

but its not providing the right results. Any help would be really appreciated..>This is my first attempt at writing a scan and has been really difficult so any help would be really appreciated!

hello and welcome.
Are...
I am having issues with the correct coding of a scan i am trying to build. On a daily timeframe i am wanting to scan for inside days with closes above the 8ema, can someone please help? I found this for the inside day...

# Inside and Outside Bar
# Mobius
# 8.7.2017

def inside = high < high[1] and low > low[1];
plot signal = inside within 1 bars;

And this is what i am using for above the 8ema

input ema_length = 8;
def ema = ExpAverage(close[1], length=ema_length);

plot signal = close > ema && open < ema;

but its not providing the right results. Any help would be really appreciated..>This is my first attempt at writing a scan and has been really difficult so any help would be really appreciated!

hello and welcome.
Are you loading 2 separate studies to run in the scan, or trying to combine all of the code in your post, into 1 scan study?

if you have all of that code in 1 scan that wont work. You can only have 1 plot function. You will have to combine the inside and the EMA plot formulas into 1 plot formula.

combine these 2 formulas,
plot signal = inside within 1 bars;
plot signal = close > ema && open < ema;

to become this,
plot signal = (close > ema) and (inside within 1 bars);

or this,
plot signal = (close > ema and open < ema) and (inside within 1 bars);

I don't know why you have open in the ema formula. You didn't mention it above in your words. that will limit when ema is true, to only be true when the ema line crosses over the body of an up candle.
-------

in the average function, there is no reason to put an offset of 1 on close. That will just delay the average data by 1 bar.
def ema = ExpAverage(close[1], length=ema_length);

change it to,
def ema = ExpAverage(close, length);

better to calulate the average with current data. if you need an older EMA value, then use an offset on ema.
def x = ema[1];

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
186 Online

## 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.