EA based on change in direction

 

Hi I am a newbie on EA

I need help in to create an EA based on change in direction of a moving average. Actually I have the code, but it needs modification. It should create a BUY when the MA changes direction from negative to positive and a SELL when it changes from positive to negative. It should also close any existing SELL orders when it generates a buy and vice versa.

Also to include the following adjustable parameters,

Lots=4; StopLoss=30; AutoStopLoss=false; TakeProfit=0; TradeAtCloseBar=true; TrailingStop=0; TrailingStep=1; BreakEven=20; MagicNumber=0; CanAddPos=false; MaxOpenOrders=5; Repeat=3; Periods=5; UseAlert=false; SendEmail=false; TradeLog="3MaCross_EA"; Slippage=3; Indicator_Setting="---------- Indicator Setting"; FasterMA=2; FasterShift=0; FasterMode=2; MediumMA=4; MediumShift=0; MediumMode=2; SlowerMA=28; SlowerShift=0; SlowerMode=2; SoundAlert=0; ChannelPeriod=15; Shift=0;

Any help would be greatly appreciated.
Files: