I would like to set stop loss and take profit levels when drawing in the function below.
function drawPositionFlag(chart, bar, shape, text, color) {
if (i == 0) {
i++;
console.log([chart, bar, shape, text, color]);
chart.createShape(
{ time: bar.time, price: bar.open },
{
shape: "long_position",
stop: bar.open - 100
}
)
}
}
Could you please advise how to implement this? I was unable to find any relevant information in your documentation.