Execution rules: fills
E3 Limit orders, E4 Stop orders, E5 Stops and targets, E6 Price path inside a bar, E7 Stop before target, E8 Same-bar exits
E3Limit orders#
A buy limit at price L fills at the bar's open when the open is at or below L; otherwise it fills at L when the price path reaches L. A sell limit mirrors this above the market. Touching the price is enough; queue position is not modelled.
Backtests have no spread, so one price per bar triggers and fills every order. Live and demo trading use the side that can actually trade: a buy is triggered and filled on the ask, a sell on the bid. A script never chooses a side; the deployment does.
E4Stop orders#
A buy stop at price S fills at the bar's open when the open is at or above S; otherwise it fills at S when the price path reaches S. A sell stop mirrors this below the market. Live, a buy stop triggers on the ask and a sell stop on the bid, as in E3.
E5Stops and targets#
A trade's stop and target are closing orders: a long trade's stop is a sell stop and its target a sell limit, and a short trade's are the mirror. They fill under E3 and E4, including at the open when a bar gaps past them. Live, a long trade's stop and target are triggered on the bid and a short trade's on the ask, because that is the side that closes them.
E6Price path inside a bar#
When events inside a bar need an order, the 1-minute bars inside it are used, because 1m is the stored base resolution; sub-minute history is not kept beyond the most recent bars, and tick data arrives later. A 1-minute bar, or any bar with no finer data stored, follows the path open → nearer extreme → farther extreme → close, where the nearer extreme is whichever of the high and low is closer to the open. When both are equally close, a bar that closes at or above its open goes to the low first, and a bar that closes below its open goes to the high first. Every price between two path points is passed through in order. Reports name the resolution each run used.
E7Stop before target#
When a trade's stop and target are both reached within one bar after the trade exists, and finer data cannot tell which came first, the stop fills. This applies even when the path of E6 would reach the target first.
E8Same-bar exits#
A trade's stop, target and management are active from the moment it fills, so a trade can close in the bar where it opened, following E6 and E7.