Skip to content

DCA and execution

DCA bot signal close vs execution fill

A candle closes at 100, but ten units fill at an average of 100.60. Trace the actual entry and the next addition without rewriting the signal.

A lime ribbon links an upright ivory ring to three ivory pieces in a shallow dish on a black surface.
Illustration for dca and execution; examples in this article are educational.

A DCA bot's signal close is the reference price used to evaluate an entry condition; its execution fill is the price at which an order actually trades. Keep both prices and their timestamps. Build acquired quantity and average entry from confirmed fills, then apply the strategy's declared ladder anchor. A completed candle does not reserve its closing price for the bot.

That difference matters before the first safety order exists. If a signal closes at 100 but the base purchase averages 100.60, a ladder drawn from 100 and a ladder anchored to the actual purchase describe different instructions.

Keep the signal record separate from the deal record

The signal record answers why an entry was considered. Retain the venue, instrument, candle interval, close timestamp, completed-candle evidence, closing price and rule revision. The deal record answers what was acquired: accepted order identity, individual executions, filled quantity, gross quote cost and commissions.

For Binance Spot, the official kline-stream specification distinguishes candle close time T, close price c and the closed-candle flag x. Those fields describe the candle. They do not report your account's execution. The candle-close confirmation guide explains what finality settles about the input itself.

Keep four clocks when possible: candle close, local receipt of the completed observation, order submission and execution. Add the decision time if calculation or approval introduces a meaningful delay. Use explicit time zones and distinguish exchange timestamps from local timestamps; an unsynchronized local clock can make a latency calculation misleading.

A message arriving just after the interval boundary is not evidence that an order could have participated in the candle's final transaction. The signal had to become observable before the bot could act on it.

Reconcile a base purchase with two fills

The following is a hypothetical unleveraged spot buy of ten asset units. All prices are in USDT per unit; commissions are excluded to isolate execution price. The quantities are supplied synthetic fills, not market observations or suggested trade sizes.

The completed candle ends at 09:59:59.999 UTC with a close of 100.00. Its final message arrives locally at 10:00:00.250. The entry decision is recorded at 10:00:00.300, submission at 10:00:00.340 and exchange acceptance at 10:00:00.380. Two execution records follow:

Execution time, UTCFilled unitsFill priceGross quote costCumulative unitsCumulative gross cost
10:00:00.4106100.40602.406602.40
10:00:00.4704100.90403.60101,006.00

The volume-weighted average execution price is:

Entry VWAP = sum(fill price × filled units) ÷ sum(filled units)

Entry VWAP = (602.40 + 403.60) ÷ (6 + 4) = 100.60

The arithmetic mean of the two prices is 100.65, which is wrong for this order because the fill quantities differ. The closing price of 100.00 is also wrong as a description of the acquired inventory's gross entry price.

Binance Spot's user-data documentation states that average price can be calculated from cumulative quote quantity Z divided by cumulative filled quantity z. These are venue-specific field names; other APIs require their own definitions. When filled quantity is zero, average execution price is undefined. Keep “unfilled” instead of substituting the signal close.

At the first fill, the provisional average is 100.40 for six units. After the second, it becomes 100.60 for ten. An accepted order alone cannot supply either average. The partial-fill guide covers management of the unexecuted remainder; here the concern is which confirmed average becomes the base-entry reference.

Measure the difference against a named benchmark

For this buy, define an adverse difference from the signal close as:

10,000 × (entry VWAP − signal close) ÷ signal close

The example produces 10,000 × (100.60 − 100.00) ÷ 100.00 = 60 basis points, or 0.60%. This requires a positive reference price. For a sell, reverse the subtraction if positive values are meant to represent worse execution.

Call this the difference from the signal close. It includes whatever happened between that reference and execution; it does not isolate market impact. The market may have moved before submission, the spread may contribute, and available depth may require several fills. A quote snapshot at the decision or submission time supplies another benchmark, but it still needs its own timestamp and venue.

Compare the order-book depth worksheet when estimating executable size. A narrow quoted spread does not establish that ten units can trade at the best ask. The latency-budget guide addresses when a signal should expire; a price difference by itself does not reveal which processing stage caused it.

Decide what anchors the next planned addition

Assume this exercise declares its first additional buy at 2% below the finalized gross base-entry VWAP. That is an illustrative rule, not a universal DCA convention or a claimed KLINEO setting.

CalculationUsing the signal closeUsing the declared execution anchor
Reference price100.00100.60
Gross cost of ten units1,000.001,006.00
First addition reference, 2% lower98.0098.588

The rightmost addition is higher by 0.588. These are raw reference prices before exchange tick rules. Changing the anchor can change when the next condition becomes eligible, even though both configurations display “2%.” The spacing guide explains alternative ladder conventions. This example concerns the base entry's reference; it does not assume later planned levels were crossed or filled.

Write whether the anchor freezes only after the base order is terminal, updates after every partial fill, or follows another explicit policy. If additions may be submitted after the first partial fill, a later execution can change the base average while those additions already exist. Updating a local number does not amend an exchange order. That case needs reconciliation of the existing instructions before issuing replacements.

Also distinguish a ten-unit request from a 1,000-USDT spending budget. The example's ten units cost 1,006 USDT before fees; it does not satisfy a 1,000-USDT cap. Budget-based sizing must use the actual submitted order semantics and confirmed quantity. Subsequent additions introduce their own safety-order volume rounding; planned units and executable units should remain separate fields.

Use a short entry-evidence worksheet

Before comparing a backtest with an observed deal, complete these fields:

FieldEvidence to retain
Signal referenceExact venue, market, candle window, confirmed close and rule revision
TimingClose, receipt, decision, submission and execution clocks with their source
Order scopeBase quantity or quote budget, order identity and terminal status
Actual acquisitionDeduplicated fills, total gross quote cost, quantity and separate fees
Ladder policyAnchor definition, partial-fill handling and any existing orders affected
Comparison modelAssumed fill time, fill price, costs and any missing execution evidence

After a restart, establish ownership before attaching an old exchange order to this evidence chain. The startup order-adoption guide addresses that proof. A plausible price match cannot establish that a preexisting order belongs to this signal.

In research, inspect the execution model as carefully as the indicator. TradingView's strategy documentation says its default broker emulator fills no earlier than the next available tick; with default bar-close calculation, that is the following bar's open. Settings can change the simulation convention. This describes TradingView's emulator, not a promise about live fills or KLINEO's engine.

An OHLC backtest that buys at the signal close has made a fill assumption. It may still be useful for a clearly stated exercise, but matching the signal rule alone does not establish execution parity. Keep the close as the decision reference, the fill average as execution evidence and the difference as a measured result with known limits.

Prepared with AI assistance under the editorial policy. The prices, timestamps and quantities are hypothetical; cited documentation establishes only its stated venue or simulation behavior. No live execution study or profitable trading rule is reported.

Keep the context with the example.

Each worked example is illustrative, with its sources and assumptions in the article. Read our editorial standards for authorship, verification and corrections.