Hello all,
I am beginner trying to place some paper trades based on tradingview webhook alerts.
The code tries to sell a position and then buy back when price falls by 50% with a stop price when price increases by 15%.
The code executes but I get an error - bracket orders must be entry orders.
Any help will be appreciated. Thanks.
api.submit_order(
symbol=webhook_message['ticker'],
side='sell',
type='limit',
limit_price=webhook_message['close'],
qty=1,
time_in_force='gtc',
order_class='bracket',
take_profit=dict(limit_price=webhook_message['close'] * 0.50,
),
stop_loss=dict(stop_price=webhook_message['close'] * 1.15,
limit_price=webhook_message['close'] * 1.15,
)
)