How to close the oldest trade on opposite signal

i am a paid user and need below feature request;

If an opposite side signal comes, close exactly one oldest trade(FIFO) , otherwise open a new trade on the current side.

Basically , it must allow multiple concurrent trades and nets them out one-by-one as signals alternate.
For example :

BUY XAUUSD OO=FIFO

  • EA must close the ongoing oldest SELL trade. If no ongoing SELL trade , then open a new BUY trade.

Same for SELL side also. For example :

SELL XAUUSD OO=FIFO

  • EA must close the ongoing oldest BUY trade. If no ongoing BUY trade exists, then open a new SELL trade.