Exponential Moving Average

This is a forum to discuss trading tools and approaches to timing the market.
Post Reply
murphy
Posts: 7
Joined: Tue Jul 21, 2015 8:50 pm
Contact:

Exponential Moving Average

Post by murphy » Mon Oct 23, 2017 11:45 am

Hello Everyone,

I was hoping to get some help or advice, i want to plot a bollinger band based on a exponential moving average with a .25 std deviation.

I did notice the bollinger classic indicator but it is based on a simple moving average.

My coding abilities would be similar to a goldfish and iv been harrassing Earik enough already :D

Best Regards,

Peter.

User avatar
earik
Site Admin
Posts: 477
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: Exponential Moving Average

Post by earik » Wed Oct 25, 2017 4:31 pm

Hi Peter,

Try this:

Code: Select all

input: price(close),length(14),standarddev(0.25),color(red);

sdev = stdev(price,length);
xavg = xaverage(price,length);

bb_up = xavg + (standarddev * sdev);
bb_dn = xavg - (standarddev * sdev);

plot1 = bb_up;
color1 = color;
plot2 = bb_dn;
color2 = color;
Copy that, paste into a new script, set the scaling to "price" in QScript Properties, Build it, and it will show up in the "Technicals" menu. Let me know if you get stuck.

Earik

murphy
Posts: 7
Joined: Tue Jul 21, 2015 8:50 pm
Contact:

Re: Exponential Moving Average

Post by murphy » Wed Oct 25, 2017 6:51 pm

Hi Earik,
Thanks for the quick reply.
Im getting the following when I try to compile the script:

ERROR:Unknown function"stdev" (Line3)
ERROR: Illegal Math expression. (Line3)

User avatar
earik
Site Admin
Posts: 477
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: Exponential Moving Average

Post by earik » Thu Oct 26, 2017 5:05 pm

Oops. Try stddev rather than stdev (two d's vs just one). Typo on my part...

Regards,

Earik

murphy
Posts: 7
Joined: Tue Jul 21, 2015 8:50 pm
Contact:

Re: Exponential Moving Average

Post by murphy » Thu Oct 26, 2017 5:20 pm

Earik that worked perfect.

A boring indicator to some,but a very important part of my price action studies.

Thank you very much. :D :D

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests