How to set the position of TP/SL during initialization?
According to the document convention, I implemented 'IBrokerWithoutRealtime' in the code. When initializing the position acquisition, I obtained the takeProfit/stopLoss fields, and their values are inconsistent; but why is there only one line on the chart showing the draggable TP/SL button? I understand that the data and the chart are bound, but now it seems that this is not the case. If I want to immediately draw the takeProfit/stopLoss in the positions to the corresponding TP/SL line after obtaining them, what should I do? Looking forward to your reply, thank you very much.
Version:charting_library V26. Example: export default class BrokerApi implements IBrokerWithoutRealtime { ... async positions(): Promise<Position[]> { const position = await Store.position.get(); return position || []; } ... }
I would recommend reading our article about Bracket Orders. The way the library works is that you'll need to plot the main order and then link each bracket order (for TP & SL) to it.