This is a very common problem and people often ask me why their EAs produce multiple trades non stop. Here is my answer...
Variant 1
The current count of trades is not checked before creating a new trade. Remember that blocks such as "Buy now" and "Sell now" are designed to create a new trade every time they run. If "Buy now" block runs 10 times, 10 trades should be created as a result. So, the idea is to not allow these blocks to run too often. The very first examples here show you exactly that - https://fxdreema.com/examples As you can see, the easiest way to be sure that you only have 1 trade at a time is to connect "No trade" block somewhere above "Buy now" and/or "Sell now".
Variant 2
You use "Close trades" somewhere and what really happens is that every time a new trade is created, it is closed immediately after that.
It's important to remember that every time you run "Close trades" block, it does its job - if there are trades to be closed, they will be closed. So it's important to run "Close trades" only when trades needs to be closed. Look at Variant 1 and you will see that this is also true for blocks "Buy now" and "Sell now" - you only need to run these blocks when a new trade needs to be created.
Again, you need to use some conditions or filters above blocks "Buy now", "Sell now" and "Close trades". But the conditions above "Buy/Sell now" and the conditions above "Close trades" MUST NOT be true at the same time.
What people often do is that they connect their "Buy now" and "Sell now" blocks with certain conditions and then they use the same conditions above "Close trades" block. And the result is that trades are created and immediately after that they are closed, because the conditions to create trades and close trades are the same.
How to fix the problem? It depends on the situation. For example, look at this project - https://fxdreema.com/demo/mt4-buy-sell-buy-sell-opposite-conditions You can see that "Close trades" blocks are used under exactly the same conditions to Buy and Sell. You may say "But fxDreema, you just said that this is wrong...". And again, it is wrong to close trades right after they are created, but if you try this particular expert advisor you will see that such thing does not happen and everything works fine.
Let me repeat that again - do not allow "Close trades" to run shortly after a trade creation.