How to prevent from calling closing position on each tick twice

 

I wrote a simple EA and I have a big problem

I want to call on each tick closing position when profit is generated, but I have a serious problem with closing position only once

Sometimes ticks are generated too fast and function generates signal to close position twice

I want to have this call from each tick, but I don`t know how to prevent calling twice closing position due to too short time between ticks and when function close position finaly

Also I have a block in my EA, which on each tick generates opening a new order when I have loss position and generating automatically heading positions with calculated lots

Problem is the same, I have twice signals due too close ticks

Please help enyone

Greetings

 

If you use the standard class CTrade, try .SetAsyncMode(false).

That causes the CTrade object to use OrderSend() instead of OderSendAsync().

Without sourcecode nobody will be able to help you further.