Many Trades

 
I have created an expert that opens a buy order when a fast MA is > a slow MA, with 30 Stop loss, 60 Takeprofit and 30 trailing stop (just a try).

The reversal for the sell.

The problem is that when the target is reached and the buy order is closed the expert opens another buy order imedeately as the slow MA is still > the fast MA. The same thing happens when the order is closed by the trailed stop loss.

How can I make it to only take a reversal signal after the first trade is closed? That is only a sell signal should be taken after a buy signal is closed.

Thanks in advance,
 
You need to include logic to only take a trade once per cross. Think through the problem.

If "last time ma's crossed" > "last time order closed" then take the trade.
If "last time ma's crossed" < "last time order closed" then don't take the trade.

If you need help programming in MQL4, check out the yahoo group.
http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/