Skip to main content

Joke_MA for Amibroker (AFL)

growex over 11 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

over 11 years ago

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

4. growex
over 11 years ago

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
about 11 years ago

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);

about 11 years ago

Replace last line with

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

about 11 years ago

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

9. growex
about 11 years ago
tourist007, thank you for your help.

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

12. davidalan
about 11 years ago
Buy =(Ref(line,-1)<line);
Sell = (Ref(line,-1)>line);
PlotShapes( shapeUpArrow * Buy, colorGreen, 0);
PlotShapes( shapeDownArrow * Sell, colorRed, 0);
13. kv_maligi
about 11 years ago
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);
about 11 years ago
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
about 11 years ago
_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
about 11 years ago

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

17. growex
about 11 years ago

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.