Skip to main content
Track Mechanical trading system
3 / 22
Library

1991issue C111-7

From a differenced-average sketch to coded rules

A visual read of a differenced moving average is unfinished until it becomes one coded procedure. Crossings must be auditable, filters must match the scale of the numbers, and the first tester pass answers whether the rules ran.

  • Differencing successive values of a 35-day simple moving average of closes put later inspection on a detrended path, and hand-drawn lines marked trend start and end rather than exact highs and lows.
  • A mechanical-trading-system begins when that sketch is reduced to one coded procedure; a smoother of the difference series was substituted for unavailable daily trendlines so crossings could be referenced in code.
  • Skeleton-rules omit stops so the first tester pass can show whether the rules ran, and a worksheet-audit is required when the chart display is unreliable.
  • The first crossing-filter used a 0.005 gap because separations appeared in the third and fourth significant digits, and that draft was still treated as unfinished.
Entries in this reading3 entries

A detrended path before any coded rule

Construction began by differencing successive values of a 35-day simple moving average of closes so later inspection acted on a detrended path. Differencing replaces a level series with the change from one sampling period to the next so later rules act on the detrended path rather than on the raw trend.

Hand-drawn lines on that differenced average were used to mark the start and end of price trends rather than the exact highs and lows.

From sketch lines to one procedure

The intended mechanical procedure was to trade the trend of the differenced average after reducing the sketch to explicit rules and then checking loss behavior on other spans of the same market. A mechanical-trading-system is a single coded procedure that turns those crossings into entry, exit, and later abstention without redrawing lines by hand.

Editorial. TradersWeek treats this construction as a translation job. The visual read is unfinished until the sketch is one coded procedure whose crossings can be audited, whose filters match the scale of the numbers, and whose first tester pass answers whether the rules ran, not whether the idea is ready to fund.

A smoother that code can cross

Because an automatic daily trendline series was unavailable, a smoother of the difference series was substituted so crossings could be referenced in code. The moving-average in this workflow is a fixed-lookback average of closes used both as the series being differenced and as a smoother of that difference so crossings can be coded.

When the chart and the table disagree

When the plotted smoother of the difference series looked too high near a mid-year peak, tabulated values were used to verify crossings because the chart display was unreliable. That step is a worksheet-audit: checking tabulated indicator values against the intended crossings whenever the chart display and the tester disagree.

Worksheet check of DIFF35 against its average

Exact worksheet values Sweeney used to test whether the June plot of the averaged difference sat too high. DIFF35 is the day-to-day change in a 35-day simple moving average of T-bond closes; AVERAGE is the smoother drawn on that difference. The highlighted pair is the June crossover he then checked back on the chart.
Exact worksheet values Sweeney used to test whether the June plot of the averaged difference sat too high. DIFF35 is the day-to-day change in a 35-day simple moving average of T-bond closes; AVERAGE is the smoother drawn on that difference. The highlighted pair is the June crossover he then checked back on the chart.Treasury bond futures · daily

Table is the article’s Figure 4 accuracy check. Values are as printed in the two-column worksheet excerpt; the highlighted row is the June crossover Sweeney verified by hand.

Skeleton-rules before risk controls

The first coded logic used skeleton-rules: the simplest entry and exit, with stops omitted, so the rule set could be checked before risk controls were added.

A tester pass can fail for reasons outside the trading rules. After the parser accepted the logic, insufficient memory produced unusable profit-and-loss fields until allocation was increased. Once tabulated values showed the engine followed the rules, the next change was a filter on the crossings.

A crossing-filter sized to the digits

A minimum gap of 0.005 was added because indicator levels were on the order of 0.032498 and separations appeared in the third and fourth significant digits. That crossing-filter is a minimum gap required between the differenced average and its smoother before a signal counts, sized from the digits at which those two series actually separate.

That first filtered draft was treated as unfinished. The 0.005 gap was arbitrary, long and short sides might need different gaps, and remaining work included other periods, capital, stops, and the size and distribution of adverse moves.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
3 of 22 in the Mechanical trading system track
20031-1 pp.Next on Mechanical trading systemCommodity enthusiasm is not a complete systemA popular buying narrative can fail while another market looks strong. Neither story is a mechanical trading system.
All readings on this track · 22 readings
  1. 1985Treat a shared mechanical printout as a public script
  2. 1988Pessimistic margin ranking for mechanical systems
  3. 1991From a differenced-average sketch to coded rules
  4. 2003Commodity enthusiasm is not a complete system
  5. 2005Reader surveys as system evaluation checklists
  6. 2008Critiquing unchanged mechanical signals in evolving markets
  7. 2010Read a mechanical trading system catalog as a specification checklist
  8. 2011Specify mechanical system signals as one testable procedure
  9. 2012Treat a packaged mechanical system as one inspectable procedure
  10. 2013Mechanical trading systems as complete signal procedures
  11. 2013Testable cycle rules as one procedure
  12. 2014Evaluate mechanical trading systems as one procedure
  13. 2015Mechanical trading systems as one testable procedure
  14. 2016Evaluating mechanical trading systems as testable procedures
  15. 2016Reading a systems catalog as one mechanical procedure
  16. 2018Mechanical systems as testable signal procedures
  17. 2019Treat mechanical system listings as specification audits
  18. 2019Match the automation stack to mechanical system constraints
  19. 2019Bar size as a mechanical system construction constraint
  20. 2020Interrogating mechanical system listings as one procedure
  21. 2020Mechanical systems still need emotion rules
  22. 2020Comfort, not theory, keeps mechanical rules in use
All 322 readings tagged Mechanical trading system
Also on Mechanical trading system5 readings