Help needed for a small AFL

#1
Dear friends,

Have heard of this site from a friend of mine

I am a newbie in technicals, have just learned to set up amibroker with data from a yahoo group for daily charts

I am desperately trying to write an afl to show me the following condition

I want to plot a 5 ema on a daily chart and I want to get buy and sell arrows when the ema turns.

Can anyone please help this newbie get started?
All help is appreciated and thanks in advance.
 

nanu

New Member
#2
Dear friends,

Have heard of this site from a friend of mine

I am a newbie in technicals, have just learned to set up amibroker with data from a yahoo group for daily charts

I am desperately trying to write an afl to show me the following condition

I want to plot a 5 ema on a daily chart and I want to get buy and sell arrows when the ema turns.

Can anyone please help this newbie get started?
All help is appreciated and thanks in advance.

just copy paste and save in formula editor
it will change colour with the slope(but not buy sell arrow)
here it is

_SECTION_BEGIN("COLOURED 5 EMA");
m = MA(C,5);
Plot(m,"m",IIf(m > Ref(m,-1),colorGreen,colorRed),styleDashed);
_SECTION_END();
 

colion

Active Member
#3
To plot arrows you need to define Buy and Sell and then use Plotshapes().

m = MA( C, 5 );
Buy = IIf( m > Ref( m, -1 ), 1, Null );
Sell = IIf( m <= Ref( m, -1 ), 1, Null );
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Plot( C, "", colorPaleGreen, styleBar );
Plot( m, "", colorRed, styleThick );
PlotShapes( shapeUpArrow * Buy + shapeDownArrow * Sell, IIf( Buy, colorBrightGreen, colorRed ), IIf(Buy, -25, 25) );
 

Similar threads