too many orders at once

 
it seems for some reason when I back test my strategy I get several orders per minute. It is just a simple stop and reverse system based on a double moving average crossover.

28 2007.09.17 04:27 close 14 1. 00 1. 3871 0. 0000 0.0000 -30. 00 9244. 70
29 2007.09.17 04:27 sell 15 1.00 1.3871 0.0000 0. 0000 0.00 9244. 70
30 2007.09.17 04:27 close 15 1. 00 1. 3874 0. 0000 0.0000 -30. 00 9214. 70
31 2007.09.17 04:27 buy 16 1.00 1.3874 0.0000 0.0000 0. 00 9214. 70
32 2007.09.17 04:27 close 16 1. 00 1. 3871 0. 0000 0.0000 -30. 00 9184. 70
33 2007.09.17 04:27 sell 17 1.00 1.3871 0.0000 0. 0000 0.00 9184. 70
34 2007.09.17 04:27 close 17 1. 00 1. 3874 0. 0000 0.0000 -30. 00 9154. 70
35 2007.09.17 04:27 buy 18 1.00 1.3874 0.0000 0.0000 0. 00 9154. 70
36 2007.09.17 04:27 close 18 1. 00 1. 3871 0. 0000 0.0000 -30. 00 9124. 70
37 2007.09.17 04:27
 
I think I need a way not to perform any trade actions for at least one minute after any trade action has occurred. something like:

Ticket = OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,NULL,0,0,Green);
Time = TradeTime;


if (conditions to close = true)
{
if (Time > TradeTime + 60 Seconds)
{
OrderClose(Ticket,1,Bid,3,White);
Time = TradeTime;
}
}
 

There is a flaw in your logic.

If you are using current values for MAs they can cross back and forth with every tick at certain junctions. Use previous bar values or use crossover of at least 1 pip for more stable results.