Home/Dovee/Function reference

buy

Open or add a long (or cover a short if the script is short only).

Reference/Language/Language

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

Inside a when body. Dovee draws a Buy arrow and the bar close (Buy @ 24150.00) — you do not need arrow, label, or paint. With long only, buy is the only entry. By default (one trade at a time), a second buy is ignored while already long — no extra Buy arrow until a sell or exit. Write re-entry to allow adds. Live size still comes from Deploy, not from this word. buy above X places a buy stop and buy below X a buy limit: the order is set at this close, waits for the next bar, and fills at X, or at the open when the bar opens past X. It lasts one bar unless for N bars is written, and a rule that is true again replaces it with the new level. The position checks happen at the fill, so a buy order is dropped while already long. buy stop at X is not an order; it is buy plus a separate stop at X.

Return value

signal +1

Example

when close crosses above ema(21)
  buy

See also