Opening a buy position

 
Hello. I have a little problem. I have set the conditions to open a position, but ea opens a multitude of positions per second, just like in the picture.
Does anyone know what I have to do to open 1 position and the next one opens only when it closes and the conditions are met?
Files:
Multum.jpg  101 kb
 
Lomcio 99:
Hello. I have a little problem. I have set the conditions to open a position, but ea opens a multitude of positions per second, just like in the picture.
Does anyone know what I have to do to open 1 position and the next one opens only when it closes and the conditions are met?

Fix your code

 
amando:

Fix your code

I am designing this EA in ***.
Do you know what block or what option I can use?
 
Lomcio 99: Do you know what block or what option I can use?

MT4: Learn to code it.
MT5: Begin learning to code it.

If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

or pay (Freelance) someone to code it. Top of every page is the link Code Base.
          Hiring to write script - General - MQL5 programming forum 2019.08.21

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help 2017.04.21

 

in beginning of  OnTick() function  write this code:

if(PositionsTolal()>0)return;

Reason: