Orders

Market, limit, stop, close, modify, cancel.

AlgoBarsX
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 bars
buy stop: high + 2 pips, risk: 0.5%, stop_loss: low - 2 pips, target: 2R, ghost: true
sell market: GBPUSD, size: 0.3 lots
when history.today.pnl < -(2% of account.balance) or account.margin_level < 150%: close_all
for 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_price
cancel orders.pending(tag: "grid")
  • buy and sell with no limit: or entry stop: are market orders. They fill at the next bar's open (E1).
  • buy limit: price places a pending limit order. buy stop: price places a pending stop order, and its protective stop is then stop_loss:.
  • expires: cancels a pending order after a number of bars or a length of time (E17).
  • ghost: true keeps 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, modify and cancel act 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).

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account