Orders
Market, limit, stop, close, modify, cancel.
when was(trend_up, within: 5 bars) and held(close > open, for: 3 bars) every bar:buy limit: lowest(low, 5), size: 1 lot, expires: 10 barsbuy stop: high + 2 pips, risk: 0.5%, stop_loss: low - 2 pips, target: 2R, ghost: truesell market: GBPUSD, size: 0.3 lotswhen history.today.pnl < -(2% of account.balance) or account.margin_level < 150%: close_allfor trade in trades.open(tag: "breakout"):if trade.r >= 3 and rsi(close, 14) > 75:close trade, size: 50%for trade in trades.open(side: long):modify trade, stop: trade.entry_pricecancel orders.pending(tag: "grid")buyandsellwith nolimit:or entrystop:are market orders. They fill at the next bar's open (E1).buy limit: priceplaces a pending limit order.buy stop: priceplaces a pending stop order, and its protective stop is thenstop_loss:.expires:cancels a pending order after a number of bars or a length of time (E17).ghost: truekeeps the stop and target off the broker. AlgoBars enforces them instead.tag:labels an order and its trade, so you can close, cancel or report on a group.close,close_all,modifyandcancelact on open trades and pending orders.
What happens when a signal arrives opposite an open trade is the header setting opposite: ignore (the default), close, reverse or hedge (E18).