Help to convert this AFL into Metatrader4 formula

 

Dear All,

I want a help to convert this amibroker afl to metatrader4 formula and after that i want to convert it into EA.

SetChartOptions ( 0,chartShowArrows|chartShowDates);

_SECTION_BEGIN ( "Background_Setting" );

SetChartBkGradientFill ( ParamColor ( "BgTop", colorBlack),

ParamColor ( "BgBottom", colorBlack), ParamColor ( "titleblock",colorDarkTeal ));

_SECTION_END ();

 

 

_SECTION_BEGIN ( "Flower" );

Prd1= Param ( "ATR Period", 4, 1, 20, 1 );

Prd2= Param ( "Look Back", 7, 1, 20, 1 );

green = HHV ( LLV (L,Prd1)+ ATR (Prd1),Prd2);

red = LLV ( HHV (H,Prd1)- ATR (Prd1),Prd2);

flowerClose = EMA ((Open+High+Low+Close)/ 4, 3 ) ;

flowerOpen = EMA (( Ref (Open,- 1 ) + Ref (flowerClose,- 1 ))/ 2, 3 );

Temp = Max (High, flowerOpen);

flowerHigh = EMA ( Max (Temp, flowerClose), 3 );

Temp = Min (Low,flowerOpen);

flowerLow = EMA ( Min (Temp, flowerClose), 3 );

barColor= IIf (C>Green,colorBlack, IIf (C < RED,colorRed,colorBlack));

PlotOHLC ( IIf (flowerOpen<flowerClose, flowerOpen, flowerClose),flowerHigh,flowerLow, IIf (flowerOpen<flowerClose, flowerClose, flowerOpen), "Close", barColor, styleNoTitle | styleCandle);

 

_SECTION_END ();

_SECTION_BEGIN ( "OsSetting" );

OBSetting= Param ( "Setting", 45, 1, 500, 1 );

Bline = StochD (OBSetting);

Oversold=Bline<= 30 ;

Overbought=Bline>= 85 ;

_SECTION_END ();

_SECTION_BEGIN ( "Breakout Setting" );

Buyperiods= Param ( "Breakout periods best is usually 18", 5, 1, 100, 1, 1 ); //10 is good for adding

Sellperiods= Param ( "Exit Breakout", 6, 1, 100, 1, 1 ); //4 is good for adding

Buy

= C> Ref ( HHV (H,Buyperiods),- 1 );

Sell

= O< Ref ( LLV (O,Sellperiods),- 1 );

/* exrem is one method to remove surplus strade signals. It removes excessive signals of arrow */

top= Max (Close, Ref (Close,- 1 ));

Buy

= ExRem (Buy, Sell);

Sell

= ExRem (Sell, Buy);

shapeUpArrow

= Param ( "Buy Shape Typ", 59, 1, 60, 1 );

//shapeDownArrow = Param("Sell Shape Typ",60,1,60,1);

PlotShapes (shapeUpArrow * Buy, ParamColor ( "Buy Arrow", colorYellow), 0,flowerLow, - 15 );

//PlotShapes(shapeDownArrow * Sell, ParamColor("sell Arrow", colorRed),0,flowerLow, - 15);

PlotShapes ( IIf ( Sell, shapeDownArrow, shapeNone ), colorCustom12, layer = 0, yposition = top, offset = - 60 );

 

_SECTION_END ();

 

 

 

_SECTION_BEGIN ( "Parameters" );

LB1= Param ( "Long LookBack Periods", 42, 1, 60, 1 );

LB3= Param ( "Mid LookBack Periods", 18, 1, 30, 1 );

LB2= Param ( "Short LookBack Periods", 6, 1, 30, 1 );

_SECTION_END ();

 

 

Title

= StrFormat ( "\\c02 {{NAME}} | {{DATE}} | Open : %g | High : %g | Low : %g | Close : %g | Change = %.1f%% | Volume = " + WriteVal ( V, 1.0 ) + ", {{VALUES}}",

O

, H, L, C, SelectedValue ( ROC ( C, 1 )) );

 

 

 Thanks..

Reason: