Open and Close Positions on ByBit Automatically

Bybit1

It is convenient when a reverse order from your strategy/indicator closes an existing position before opening. In this article, we detail how you can achieve this while automating TradingView alerts to ByBit.

For you to successfully perform this operation, you will need to switch the Position Mode to One-Way Mode on your ByBit account under settings. After verifying these settings, proceed as follows:
For a strategy, use {{strategy.order.action}} to generate the Buy/Sell action and specify your quantity, say Q=0.02.

Once the first alert has fired and successfully opened a trade on your ByBit account, edit your alert on TradingView and double the quantity, in this case, it would be q=0.04

Now, when the next alert comes in, half of the position is used to offset the open position while the other half opens a new position. That way you can always keep closing existing positions and opening new positions on reversal.

It’s that simple! Keep it TradingView To Anywhere for more trading tips and hacks :slight_smile: