Home/Dovee/Function reference

sell

Open a short, or close a long when the script is long only.

Reference/Language/Language

sell    sell below expr [for N bars]    sell above expr [for N bars]

Inside a when body. Draws a Sell (or Exit, when long only) arrow and the fill price automatically. long only turns sell into an exit. Two-way scripts flip: sell while long closes long and opens short. A second sell while already short is ignored until a buy. short only uses sell as the entry. sell below X places a sell stop and sell above X a sell limit, with the same timing and lifetime as buy above / buy below. With long only, a sell order is a resting exit for the long and is dropped while flat.

Return value

signal -1

Example

short only
when ema(9) crosses below ema(21)
  sell

See also