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

Joke_MA for Amibroker (AFL)
growex
about 9 years ago
Amibroker (AFL)

Rating:
4 / 5 (Votes 6)
Tags:
amibroker, moving average

This is slightly improved version of simple moving average. This line has a little better responce to price changes and at the same time it isn’t very sensitive to fast cycle’s noise

Screenshots

Indicator / Formula

Copy & Paste Friendly
//JokeMa Indicator
//by GrOwEx
SetBarsRequired( -2, -2 );
Period = Param("Period",5,1,3000,1);
price = Close;
Start = Param("MAStart",1);
j = start;
s = 0;
while (j<=period)
{
k = Ref(ma(price,j),-j/2);
s = s+k;
j=j+1;
}
line = s/(period-(start-1));
Plot(line,"ma"+WriteVal(line,0),IIf(Ref(line,-1)>line,colorRed,IIf(ref(line,-1)<line,colorGreen,coloryellow)),styleLine,Null,Null,Null,Null,3);

17 comments

1. anandnst

Getting error in 5.4 amibroker

Plot(line,"ma"+WriteVal(line,0),IIf(Ref(line,-1)>line,colorRed,IIf(Ref(line,-1)<line,colorGreen,colorYellow)),styleLine,Null,Null,Null,Null,);

Last line

2. growex

anandnst, copy/paste it again please.

3. RAKESH.NASCENT

Please write what is the logic behind the MA.
Looks good!

4. growex

RAKESH.NASCENT, thank you

The differences from SMA are:
1. Simple averaging just clear out all faster cycles. This is why SMA is lagging.
2. My averaging techique keeps all faster cycles in place so we can see its influence in the end result. In the same time it reduces visible lag.
Displacement tecnique is very well known so here’s nothing new. I simply move it forward for 1/2 of cycle’s length.

Hope it helps.

5. iaq110

error Ami broker 5.20
plz solve

Plot(line,"ma"+WriteVal(line,0),IIf(Ref(line,-1)>line,colorRed,IIf(ref(line,-1)<line,colorGreen,coloryellow)),styleLine,Null,Null,Null,Null,3);

6. tourist007

Replace last line with

Plot(line,"ma"+WriteVal(line,0),IIf(Ref(line,-1)>line,colorRed,IIf(Ref(line,-1)<line,colorGreen,colorYellow)),styleLine);

7. prathjoshi

Dear Growex,
Thanks for this formula
can U give me your email ID Plz.

8. prathjoshi

hi,
is it possible convert this to excel format
my email prathyushjoshi@gmail.com
thanks in advance

9. growex
tourist007, thank you for your help.

prathjoshi, interesting, i will try to convert it….

10. prathjoshi

Any body help to me for convert this to excel format

11. amifan

Hello growex,
Nice concept …
Thank you very much

12. davidalan
Buy =(Ref(line,-1)<line);
Sell = (Ref(line,-1)>line);
PlotShapes( shapeUpArrow * Buy, colorGreen, 0);
PlotShapes( shapeDownArrow * Sell, colorRed, 0);
13. kv_maligi
SetChartBkColor(ParamColor("Panel Color",colorLightGrey));
//JokeMa Indicator
//by GrOwEx
SetBarsRequired( -2, -2 );
Period = Param("Period",5,1,3000,1);
price = Close;
Start = Param("MAStart",1);
j = start;
s = 0;
while (j<=period)
{
k = Ref(MA(price,j),-j/2);
s = s+k;
j=j+1;
}
line = s/(period-(start-1));
Plot(line,"ma"+WriteVal(line,0),IIf(Ref(line,-1)>line,colorRed,IIf(Ref(line,-1)<line,colorGreen,colorYellow)),styleLine);
//Plot(line,"ma"+WriteVal(line,0),IIf(Ref(line,-1)>line,colorRed,IIf(Ref(line,-1)<line,colorGreen,colorYellow)),styleLine,Null,Null,Null,Null,3);

Buy =(Ref(line,-1)<line);
Sell = (Ref(line,-1)>line);
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy ); 
PlotShapes( shapeUpArrow * Buy, colorGreen, 0);
PlotShapes( shapeDownArrow * Sell, colorRed, 0);
14. prathjoshi
Buy =(C>line);
//Buy =(Ref(line,-1)<line);
Sell = (C<line);
//Sell = (Ref(line,-1)>line);
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
PlotShapes( shapeUpArrow * Buy, colorGreen, 0);
PlotShapes( shapeDownArrow * Sell, colorRed, 0);
15. davidalan
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
//thanks for the help god bless you all
16. parfumeur

Can we post the corrected code with line notes “//” in the <pastie> section? Thanks

17. growex

prathjoshi, sry, i have no excel installed on my PC atm :(

parfumeur, if you ask me, then yes, ofcourse you can…

Leave Comment

Please login here to leave a comment.

Back