Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions