Stop bot to open more then 1 trade

Safeer Altaf
14
Hi

My bot is taking trade everytime once condition meet.

I want my bot to take only 1 trade untill TP or stopless hit

Can anyone guide
Vladimir Karputov
Moderator
301933
Safeer Altaf :
Hi

My bot is taking trade everytime once condition meet.

I want my bot to take only 1 trade untill TP or stopless hit

Can anyone guide

The simplest is to use the PositionsTotal call: if there are positions in the market, then just exit OnTick.

Documentation on MQL5: Trade Functions / PositionsTotal
Documentation on MQL5: Trade Functions / PositionsTotal
  • www.mql5.com
PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5