MA1 cross MA2

 
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.