Conversion of Amibroker formula to Metastock code

Can anyone plz convert Amibrokerk formula to Metasock code. Thanks in advance :)

============Begin AmiBroker AFL code=============
//guppy moving averages setup;

g0= EMA( Close, 3 );
g1= EMA( Close, 5 );
g2= EMA( Close, 7 );
g3= EMA( Close, 9 );
g4= EMA( Close, 11 );
g5= EMA( Close, 13 );

g6= EMA( Close, 21 );
g7= EMA( Close, 24 );
g8= EMA( Close, 27 );
g9= EMA( Close, 30 );
g10= EMA( Close, 33 );
g11= EMA( Close, 36 );

sma=(g0-g5)*100;//width of short term averages - this could be smoothed by 3 day EMA - I like it fast

Lma=(g6-g11)*100;//width of long term averages

C1=IIf(sma>0,27,32);//color setup for better visual - sma is green when positive and red when negative (when sequence of ema's has reversed)

C2=IIf(Lma>0,28,46);//color setup for better visual - lma is teal when positive and plum when negative - (when sequence of ema's has reversed)

Plot(sma,"short term ema width",C1,5);//plot sma

Plot(lMA,"long term ema width",C2,5);//plot lma

diff=(g5-g6)*100;//degree of separation between sma and lma

cu=IIf(diff>Ref(diff,-1),27,32);//more color setup for easier visual - these two lines set colour - when trend is positive bars are green if width expanding and red if width contracting

Cd=IIf(diff<Ref(diff,-1),28,42);//when trend is negative bars are teal if width expanding and yellow if width contracting

Plot(diff,"ema spread",IIf(diff>0,Cu,Cd),6);//plot the bars

GraphXSpace=5;//squeezes all the graph in


you could plot arrows for buy/sell - long /short signals but they distract me on fast signals that whipsaw a bit


Similar threads