EMA codes

[Deleted]  

Hello,


Can someone please help me to convert this EMA code in EasyLanguage to MQL4? Or, if you already have the code for EA trading system, it would be great. Thanks a lot.


{ Buys if Price crosses over Avg and then stays above Avg for one or more bars }

inputs: Price( Close ), Length( 9 ), ConfirmBars( 1 ) ;
variables: Counter( 0 ) ;

if Price > XAverageFC( Price, Length ) then
Counter = Counter + 1
else
Counter = 0 ;

if CurrentBar > ConfirmBars and Counter = ConfirmBars then
{ CB > ConfirmBars check used to avoid spurious cross confirmation
at CB = ConfirmBars }
Buy ( "EMACrossLE" ) next bar at market ;


if Price < XAverageFC( Price, Length ) then

Counter = Counter -1

else

Counter = 0;


if CurrentBar < ConfirmBars and Counter = ConfirmBars then

Sell ( "EMACrosseSE") next bar at market