Skip to content
All library documents

Diagnosing a First-Day Full-Allocation Trade in a Moving-Average Backtest

Article BigQuant

Summary

This Chinese A-share backtest example uses a five-day versus twenty-day moving-average crossover to generate buy and sell signals. Its trading handler divides available cash equally among the stocks signaled for purchase, so if only one stock qualifies on a given day, that stock receives the entire available allocation. The author says that on 2015-01-05 the buy list contained only 000001.SZA, explaining the first-day full investment.

The example also contains a preparation-function naming error: it assigns the sell-signal data to a different variable than the handler later reads. As a result, the intended sell list is not set on the context. The explanation is specific to the stated signal output and code; checking the actual daily signal list and variable names is necessary when diagnosing similar behavior. It does not assess strategy performance or address broader portfolio and execution risks.

Key ideas

  • A buy list containing one stock leads this handler to allocate all available cash to that stock.
  • The example generates signals by comparing five-day and twenty-day moving averages.
  • The sell-signal list is assigned to a variable that the trading handler does not read.
  • Inspecting daily signal lists can help explain unexpected allocation behavior.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.