MA1 cross MA2

 
How do I write an EA so that a buysignal generats an open trade when Moving Average 1 cross Moving Average 2 and a sellsignal when MA2 cross MA1 how to write the cod so that I trade for 10 % of the capital on my account?
 
That example is already written and comes shipped with MetaTrader you only need to tweak it a bit look for the examples in the Expert folder.
Reason: