EA is opening too many orders at same price and time

 
I have an EA, the trade opening condition is as follows, after market move away from the first trade by 10 pips the EA should take the second trade, if market move away from the second trade by 10 pips third trade should be opened, etc. The EA is doing exactly according to the condition only when the forex market is not moving very fast. Problem comes in when the market is moving very fast, the EA usually open too many trades that are no longer according to the condition. I will be glad to get a working solution to this problem. Thank you in advance.
 
ArchRaphael:
I have an EA, the trade opening condition is as follows, after market move away from the first trade by 10 pips the EA should take the second trade, if market move away from the second trade by 10 pips third trade should be opened, etc. The EA is doing exactly according to the condition only when the forex market is not moving very fast. Problem comes in when the market is moving very fast, the EA usually open too many trades that are no longer according to the condition. I will be glad to get a working solution to this problem. Thank you in advance.

Show the code and what do you mean by " that are no longer according to the condition"?

 
Keith Watford:

Show the code and what do you mean by " that are no longer according to the condition"?

The opening condition is 
If(count.buy()== 0)
     Open buy();

That is the condition that keeps open buy trade after taking the first buy trade. It is obvious count.buy() is no longer 0 after the first buy trade.
 
Please edit your post and use the code button (Alt+S) when pasting code.

EDIT your original post, please do not just post the code correctly in a new post.

ArchRaphael:
The opening condition is 
If(count.buy()== 0)
     Open buy();

That is the condition that keeps open buy trade after taking the first buy trade. It is obvious count.buy() is no longer 0 after the first buy trade.

Nothing is obvious with the snippet of code that you have posted.

Anyway, as it is your intention is to open a grid, it makes no sense to limit it to a single trade.