thinkScript: EMA Channel

This is a rather simple study/indicator, so I hope I just didn’t miss seeing it in the list of predefined studies. Basically, it consists of two channel lines drawn at a percentage above and below the EMA centerline. Again, Dr. Alexander Elder recommends this over the simple moving average channel. Although, in a pinch, the SMA channel works just fine.

thinkscript-ema-channel

# EMA Channel
# Author: moolala.org
# Date: 2008/04/23

input price = close;
input period = 22;
input offset = 0.01;

plot midline = ExpAverage(data = price, length = period);
midline.setDefaultColor(Color.Gray);

plot lowerBand = midline - (midline * offset);
lowerBand.setDefaultColor(Color.Blue);

plot UpperBand = midline + (midline * offset);
UpperBand.setDefaultColor(Color.Blue); 

 

As for input settings, the period is the number of bars back that is used to calculate the EMA. Offset is the multiple or percentage of the calculated EMA away from the center EMA to draw your channel lines. Here are my settings for my three favorite time frames:

Weekly

Period: 26, Offset: 0.2

Daily

Period: 22, Offset: 0.1

5 Minute

Period: 12, Offset: 0.006

 

The offset will vary depending on the EMA value. So stocks with here prices will differ from stocks with lower prices. I personally don’t tweak the offset all that often. Close is good enough for me. The goal is to have the EMA channel encapsulate about 95% of all the visible bars.

Advertisement

No comments yet

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.