Skip to content
All library documents

How to Audit a CTA Strategy Against Its Trading Specification

Article vn.py community

Summary

This tutorial teaches readers to check whether generated CTA strategy code faithfully implements its written trading rules. It organizes the review around five code areas: parameters, bar aggregation, indicator calculations, signal decisions, and position management. Using a Bollinger Band, Aroon, and ATR example, it traces 15-minute decisions built from one-minute bars, directional filtering, stop entries at the bands, fixed-size positions, and ATR-based trailing exits.

The guide emphasizes checking details that can change trading behavior while leaving code runnable: indicator parameters, warm-up data, when orders are submitted, whether trades are restricted to flat positions, and whether trailing extremes begin at the actual fill and update only in the favorable direction. It provides code excerpts and a concrete checklist, but no backtest or live-trading evidence. The author also cautions that a strategy’s logical position may not match the account’s actual position, and that reviewing the specification against the code remains necessary even when AI generates the implementation.

Key ideas

  • A written trading specification can be checked against five main areas of CTA strategy code.
  • The example combines Bollinger Band triggers, Aroon direction filtering, and ATR trailing stops on aggregated bars.
  • Position logic, order timing, and indicator warm-up behavior should match the specification.
  • Trailing stops should start from the entry fill and track favorable price extremes before recalculating the stop.
  • Runnable code and generated code do not by themselves establish that the strategy matches its specification or will perform well.

Tags

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