In MQL5, how to place a new limit order when a position closed

In MQL5, how can I submit a new buy order when a eixisting buy position closed. (and submit a new sell order when a existing sell position closed)

Count your positions by type, and open when zero.

.You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
          No free help (2017)