How the algorithms work

Each algorithm is a parent order that BackQuant works in your browser: it sends ordinary orders (its children) to the exchange, every one through the same checks as an order you send yourself, and filled plus working never exceeds your size. Every setting and default is in Algorithms.

What they share

Pricing
Peg prices each order from the market you chose plus the offset ticks as it is placed, capped at your limit and rounded to the tick away from the market; it then rests where it was placed. Only Chase, and POV at the touch, move a resting order. Sizes round down to the lot.
Your limit
No order is ever priced past it. Tighten it while running and any working order beyond it is cancelled.
Fresh prices only
A price older than Stop if prices are older than (5,000 ms by default) does not count. While prices are stale, nothing new is sent and what rests stays put.
Start at
If the engine is not running at the start time (more than 5 seconds late), the algorithm ends having sent nothing.
Start on a price
Arms on the first fresh price on the starting side of your level and starts on the first one past it. Already past when it begins (If it is already there): Refuse ends it, Start now starts at once.
Stop at
Cancels its orders and ends, stating what was left. It does not sweep the rest.
Refusals
An order the exchange rejects is tried again after 1 second; 10 in a row and the algorithm fails. A fill resets the count. An exchange that declines for a reason that passes (busy, maintenance, throttling, a halted market) is waited out, the gap growing to 30 seconds; after 10 minutes of that the algorithm fails, saying so.
Cancelled elsewhere
If one of its orders is cancelled on the exchange’s site or by the exchange, the algorithm pauses rather than placing it again.
Pause, Resume, Cancel, Edit
Pause pulls its resting orders and places nothing new. Cancel pulls them, waits for their last fills, then ends. Edit changes the limit, the stop time or the size, never below what is filled and working. A resume never places again an order that was cancelled at the exchange meanwhile.

If the engine stops, sleeps or drops

Stopped
The engine stops 15 seconds after the last BackQuant tab closes. Nothing runs then. Orders already resting stay at the exchange as plain orders. A trailing stop protects nothing while the engine is stopped.
Started again
One that had not started is cancelled, nothing sent. One that was running comes back paused, its orders left in place, until you resume it.
Asleep
If the engine misses more than 5 seconds (a laptop lid), TWAP, VWAP and POV pause and pull their orders, so they never burst to catch up.
Connection lost
Prices go stale, so it waits. An order whose outcome is unknown holds everything; after 30 seconds the algorithm pauses for you.
Another device
If another device takes the account over, running algorithms pause here and their orders are withdrawn; one not yet begun is cancelled.

TWAP

The size split into equal slices: Duration over Slice every, rounded up. After each slice the goal is that share of the size; the last slice takes what is left. One order at a time; at each new slice, what is still working is cancelled first. Falling behind, an order may carry at most two slices’ worth.

Passive
Post-only at your side’s best price (At the touch, plus the offset), resting. What does not fill rolls into the schedule.
Aggressive
Immediate at the other side’s best price (At the far side, plus the offset). Short, it tries again 2 seconds later within the slice.
No reference
TWAP, VWAP and POV price from the book by Aggression: at the touch when Passive, at the far side when Aggressive, or at a Fixed price.

VWAP

Like TWAP, but each slice is sized to the volume that usually trades then. The curve is built from the exchange’s own volume for the same hours on each of the past days you choose (Days of history, 1 to 30), each day scaled to its total, then averaged. A slice may carry at most its own and the previous slice’s weight. With a Max % of volume, it also stays under that share of the volume the engine has counted, and pauses after 30 seconds without trades.

POV

What is due is your rate times the market’s volume since the start (counted from the trades the engine receives, your own included), capped at your size. One order at a time; a passive one moves to the touch at most once a second, an aggressive one waits 2 seconds after a miss. Volume missed in a gap is not owed; a gap longer than Pause after gap pauses it.

Chase

One resting limit, priced from your reference plus the offset. It moves only when the price has moved at least Min move ticks, at most once per Reprice every (never faster than 250 ms), and only with nothing in flight. Where the exchange can amend safely against a fill arriving at the same moment it amends in place; otherwise it cancels and places again. Past Max distance from its first price it stops following. At Cross after, it cancels and sends one immediate order at the far side plus the slip, never past your limit; what is left ends it.

Trailing stop

Tracks the best price reached (the high when selling, the low when buying), only once Activate at is reached. The stop sits the trail below or above it, and fires when the price reaches the stop. Stale prices neither arm nor fire it. It then sends an immediate order at the far side plus the slippage ticks, or rests a limit at the far side; each attempt takes a fresh price, never past your limit, until the attempts run out.

Iceberg, Grid, Ladder, Scheduled

Iceberg
One slice of the visible size at a time; the next is placed when it finishes, priced afresh then. Variance changes each slice’s size by a fixed pattern for that order, not at random, the same after a restart, never under the exchange’s smallest order.
Grid
Up to 64 orders spaced in ticks away from the market from one starting price, never repriced. With Replace a level once it fills, a filled level is placed again.
Ladder
2 to 64 rungs, evenly spaced from the first price to the last, all placed at once, nearest the market first. A rung below the exchange’s minimum refuses the whole ladder. Rungs stay at the exchange if the engine stops.
Scheduled
One limit for the whole size, at the start time or price. With a Stop at, it is sent as good till that time where the exchange allows, so it expires without the engine.

One cancels the other entries

+ Other side: one cancels the other adds a second entry to the order: a breakout both ways, or a buy at support and a buy on the breakout. Each side may carry its own take profit and stop.

One at the exchange
At most one side rests at the exchange. The other is watched by the engine for its price.
When the price is reached
The resting side is cancelled in the same moment, and the fired side is sent only once that cancel has settled. Not sent within 5 seconds of its price, it expires and sends nothing: a breakout order is never sent late. If the account cannot take new orders at that moment, it expires at once and the resting side stays.
The first fill decides
On opposite sides, once either side fills anything the other is withdrawn and never sent. On the same side, the two together never open more than the size.
Its exits
Every order a side sends carries that side’s take profit and stop, held the way the exchange holds an entry’s.
If the engine restarts
The pair ends: a watched side is cancelled, and the resting order stays at the exchange as a plain order, listed paused on the Algos tab of Positions and orders, for you to keep or cancel. Cancel both in Orders cancels the pair.

More

  • Algorithms. Every setting and default.
  • Work a big order. Step by step.