Average EMA Penetration Indicator

Jusbeyou

New member
Hello,

I am currently reading Alexander Elder’s “The new Trading For A Living” book and he describes setting a BUY target at an “average EMA penetration.” I am looking for an indicator that can give me the following value:

1. on a daily chart, if 13 bar EMA is in an uptrend (higher than 2 bars ago)

2. calculate an average penetration :
if low price is lower than EMA, then subtract the low price from the EMA (average this number for the last 40 bars)

3. estimate the EMA of tomorrow:
EMA tomorrow = EMA of today + (EMA of today – EMA of yesterday)

4. calculate an entry point:
EntryPoint = EMA tomorrow – average penetration
return Entry

Is it possible to program this as an indicator?
CmYrDc0.png
 
Last edited by a moderator:
Hello,

I am currently reading Alexander Elder’s “The new Trading For A Living” book and he describes setting a BUY target at an “average EMA penetration.” I am looking for an indicator that can give me the following value:

1. on a daily chart, if 13 bar EMA is in an uptrend (higher than 2 bars ago)

2. calculate an average penetration :
if low price is lower than EMA, then subtract the low price from the EMA (average this number for the last 40 bars)

3. estimate the EMA of tomorrow:
EMA tomorrow = EMA of today + (EMA of today – EMA of yesterday)

4. calculate an entry point:
EntryPoint = EMA tomorrow – average penetration
return Entry

Is it possible to program this as an indicator?

here is something to experiment with

Code:
#avg_penetration

#https://usethinkscript.com/threads/average-ema-penetration-indicator.19249/
#Average EMA Penetration Indicator
#Jusbeyou  8/5

#I am currently reading Alexander Elder’s “The new Trading For A Living” book and he describes setting a BUY target at an “average EMA penetration.” I am looking for an indicator that can give me the following value:

#1. on a daily chart, if 13 bar EMA is in an uptrend (higher than 2 bars ago)

#2. calculate an average penetration :
#if low price is lower than EMA, then subtract the low price from the EMA (average this number for the last 40 bars)

#3. estimate the EMA of tomorrow:
#EMA tomorrow = EMA of today + (EMA of today – EMA of yesterday)

#4. calculate an entry point:
#EntryPoint = EMA tomorrow – average penetration
#return Entry

#Is it possible to program this as an indicator?


def bn = barnumber();
def data = close;

input avg_type = AverageType.exponential;
#input avg_type = AverageType.Simple;
input avg_length = 13;
def avg = MovingAverage(avg_type, data, avg_length );

plot zavg = if IsNaN(close) then double.NaN else avg;
zavg.SetDefaultColor(Color.magenta);
zavg.setlineweight(1);
zavg.hidebubble();

def r1 = avg > avg[2];
def r2 = low < avg;
def avg_penetration = avg - low;
def plen = 40;
def avgp_avg = average(avg_penetration , plen);

def avg_tomorrow = avg + ( avg - avg[1]);
def entry = avg_tomorrow - avg_penetration;

plot z = if IsNaN(close) then double.NaN else entry;
z.setdefaultcolor(color.cyan);
z.hidebubble();


plot uparrow = entry crosses above avg;
uparrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
uparrow.SetDefaultColor(Color.green);
uparrow.setlineweight(3);
uparrow.hidebubble();

plot dwnarrow = entry crosses below avg;
dwnarrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
dwnarrow.SetDefaultColor(Color.red);
dwnarrow.setlineweight(3);
dwnarrow.hidebubble();

#
 
Last edited by a moderator:

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
489 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