How To Automate TradingView Alerts to ByBit USDT Perpetual

If I am in hedge mode, and have two open positions in different direction, is there a command that close only the long or short position before entering the next trade?
Potential example:
Close Long BTCUSDT / Close Short BTCUSDT?