Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Maximum Deviation Moving Average for Amibroker (AFL)

Rating:
3 / 5 (Votes 2)
Tags:
amibroker

This is an exponential moving average which adjusts its self to maintain a minimum percentage deviation from the last close. This allows you to use slower moving averages to better smooth price without having to wait excessively long for a signal to occur when price reverses.

Of course you could use of variety of ema based averages rather than the standard ema used here.

Similar Indicators / Formulas

Kavach Of Karna v2
Submitted by hbkwarez over 9 years ago
Advanced Elliott Waves
Submitted by MarcosEn over 12 years ago
3_6Day GuaiLiLv
Submitted by motorfly over 12 years ago
Williams Alligator System
Submitted by durgesh1712 over 12 years ago
*Level Breakout system*
Submitted by Tinych over 12 years ago
Horizontal Live Priceline Tool
Submitted by northstar over 12 years ago

Indicator / Formula

Copy & Paste Friendly
// maximum deviation EMA
Per = Param("EMA Period", 22, 1, 900, 1);
MaxDev = Param("Max Deviation", 1.0, 0.0, 99.0);
alpha = 2.0/(1.0 + Per);
one_minus_alpha = 1.0 - alpha;
last_avgema = C[0];
avgema[0] = last_avgema;
for (i=1; i<BarCount; i++)
{
	ci = C[i];
	last_avgema = alpha*ci + one_minus_alpha*last_avgema;
	if (MaxDev > 0.0) {
		pctdev = 100.0*(ci - last_avgema)/ci;
    	if (pctdev >= 0.0)
    	{
        	if (pctdev > MaxDev)
            	last_avgema = ci - .01*MaxDev*ci;
    	}
    	else
    	{
        	if (-pctdev > MaxDev)
            	last_avgema = ci + .01*MaxDev*ci;
    	}
	}
	avgema[i] = last_avgema;
}

Plot( avgema, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 

13 comments

1. extremist

if u r really interested to see any result of this code then u need to use the value of MaxDev <=1. above one it wont produce any different results than tht off normal MA.
so plz change the line 2 of code with

MaxDev = Param(“Max Deviation”, 0.5, 0, 1,0.0001);

2. lel4866

You are correct that a value of 0 results in a standard ema. However, I specifically left 0 as a possible value, so that when optimizing, one of the possibilities is a standard ema.

3. prathjoshi

Dear,I want show result of this plz give me u r emailId
this is very gooooooooooooooooooooooooooooooooooooooood

4. prathjoshi

Plz note from 1st April to 9/4/13 Profit 1556 Points Last Buy signal come @ 5392 As on 9/4/13 Now today 5905 running profit 513. Means 1556 + 513 = 2069 points in just 5 months and 10 days. Also Note this figure carry stop los.

5. sutharnehal

prathjoshi

how do you trade using this system? if you can share here some details like which emas do you use, which time frame do you use etc.? you can also send me details on my email id “sutharnehal@gmail.com”. thanks in advance.

6. nareshpriya

can somebody post a screenshot with this afl on please?

7. casoni

Hello prathjoshi
can you please show us your buy-sell conditions

as you said = msg no4
[ Plz note from 1st April to 9/4/13 Profit 1556 Points Last Buy signal come @ 5392 As on 9/4/13 Now today 5905 running profit 513. Means 1556 + 513 = 2069 points in just 5 months and 10 days. Also Note this figure carry stop los. ]
Thank you

8. prathjoshi

Yes sir,

But I want more research, I want back dated data if any body have a last 1 or 2 year amibroker data plz give me.

& see result plz give e-mail ID.

Current profit 2041 points from april to 7/10/13, todays buy @ 5934 @ 2.59.59

One again I request plz give back dated amibroker intra day data for more study.

Thanks in advance.

9. casoni

SORRY…will upload again..

it missed few days

10. casoni

Download 5min IEOD [01 april 2012 to 06 Oct 2013 ] of Nifty-1 , from
http://www.megafileupload.com/en/file/458636/NIFTY-1-txt.html
thank you

11. nareshpriya

@prathjoshi or @casoni : could u please please post a screen shot of the chart with the above AFL please?

12. casoni
uploaded image of the said formula

http://i.imgur.com/RGwWpls.png

13. nareshpriya

thx @casoni

btw use this link for all kinds of data in indian stock market. @prathjoshi

http://www.tradewithme.me/data-archives-for-technical-analysts.html

Leave Comment

Please login here to leave a comment.

Back