Bybit API : Is there a way to have the SL changed to various TP Levels?

80 views Asked by At

I have multiple TPS i.e tp1,tp2,tp3,tp4,tp5 and one sl. For placing the order this is my code :

response = session.place_order(
        category="linear",
        symbol=coin,
        side=side,
        orderType="Limit",
        qty=str(formatted_qty),
        price=entry1,
        timeInForce="PostOnly",
        orderlinkid=f"t{int(time.time())}-test-postonly",
        isLeverage=1,
        orderFilter="Order",
        takeProfit=str(tp5),  # Target 5
        stopLoss=str(sl),  # SL
        tpTriggerBy="MarkPrice",
        slTriggerB="IndexPrice",
        tpslMode="Partial",
        tpOrderType="Limit",
        slOrderType="Limit",
        tpSize="20",
        slSize="100",
        tpLimitPrice=str(tp1),  
        slLimitPrice=str(sl),  # SL
    )

Now suppose I want to keep pushing the SL when it keeps hitting new tp levels, i.e if tp1 is hit then sl = entry and if tp2 is hit, then sl = tp1. How do I go about doing this? Thanks

I tried using the trading stop by putting the limit as tp1 and stop_loss = entry.

0

There are 0 answers