Skip to content

How to Set Stop Loss and Take Profit When Drawing Positions in a Chart Function #148

@Mohammadali-Ghods

Description

@Mohammadali-Ghods

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions