A technically valid breakout signal can arrive when the quoted market is unusually wide. A Sierra Chart ACSIL strategy can use a bid-ask spread gate to avoid initiating exposure under predefined execution conditions. This is an entry permission rule, not a directional forecast or a guarantee of lower trading costs.
Translate the spread into ticks
For a hypothetical futures instrument with tick size 0.25, a bid of 100.00 and ask of 100.25 imply a one-tick spread. If the ask rises to 101.00 while the bid remains unchanged, the spread becomes four ticks. With a maximum of two ticks, the first quote permits an otherwise valid entry and the second blocks it.

| Bid | Ask | Spread ticks | Entry gate |
|---|---|---|---|
| 100.00 | 100.25 | 1 | Pass |
| 100.00 | 100.50 | 2 | Pass |
| 100.00 | 101.00 | 4 | Block |
Implement the gate in ACSIL
ACSIL exposes current bid and ask through sc.Bid and sc.Ask and the chart tick size through sc.TickSize. The fragment below assumes the chart symbol is the traded symbol and positive prices are appropriate for that instrument. The small numerical tolerance avoids rejecting an exact boundary solely because of floating-point representation. Validate quote freshness and connection state separately before using this helper. It is not a complete trading study.
// ACSIL entry gate fragment, inside an existing study.
// Apply only to fresh, validated real-time quotes.
const double bid = sc.Bid;
const double ask = sc.Ask;
const double tick = sc.TickSize;
const int maxSpreadTicks = 2;
const bool valid = tick > 0 && bid > 0 && ask >= bid;
const bool spreadOK = valid &&
(ask - bid <= (maxSpreadTicks + 1e-6) * tick);
// Combine spreadOK with the existing entry signal,
// flat-position check and working-order checks.
// Do not apply this gate to protective exits.
In the existing entry branch, combine spreadOK with the signal, position state and working-order checks before calling the appropriate entry function, such as sc.BuyEntry. Inspect the return value and reconcile order status; a successful submission is not a fill. Skip order submission during full recalculation and historical downloading in a live-only branch. Keep the protective exit branch independent so a wide spread cannot disable risk management.
Define what happens to a blocked signal
One policy discards the signal immediately and waits for a new event. Another retains it for a limited number of updates, rechecking both the signal and spread before submission. The latter requires an explicit expiry, a unique signal identifier and pending-order protection. Without these safeguards a persistent condition may generate repeated orders. Compare the two policies separately.
Testing without misleading historical quotes
Current bid and ask variables are not a historical quote series for every bar. Do not loop over historical bars while using one current quote as though it belonged to each bar. Use suitable recorded quote data or supported replay behavior and validate what the data feed actually supplies. If historical quotes are unavailable, report the gate as untested historically rather than substituting candle ranges for spread.
Compare no filter, one tick, two ticks and four ticks under the same entry and exit logic. Record blocked signals, modeled fills, realized spread or slippage where available, net expectancy and drawdown. Include session transitions and volatile periods. Test invalid or crossed quotes, stale quotes, and a quote widening between validation and submission.
Limitations
A narrow quoted spread does not guarantee sufficient depth or a favorable fill. Market orders can sweep multiple price levels, and limit orders can remain unfilled. A spread filter can also exclude profitable trades. Use appropriate position sizing, protective orders and realistic costs.
Official references: ACSIL variables and arrays and ACSIL automated trading.
This educational fragment has not been compiled or backtested here. Trading involves risk of loss.
To adapt this free strategy idea, contact us about Custom Sierra Chart strategy Development Services.