1 limit sell order set at 40000 BTCUSDT
What to do:
if (BTC price < 40000 USDT)
{
set_limit_order("buy", amount)
}
You mean the price of BTC is higher than $40000, but if the price is less than $40000, you want to sell the BTC and convert it to USDT?
You will have to use stop loss order
Place limit price at $40100 or above. Then stop price at $40000.
If bitcoin price reach $40100, the order will be filled at $40000. You can adjust the limit and stop price but in a way it will not be too tight so that the order will be filled.