Skip to content
All library documents

Using the Fréchet Distance to Detect and Trade Chart Patterns

Article Robot Wealth

Summary

The document describes using the Fréchet distance to compare a price series with a predefined shape, such as a triangle or cup. Pattern arrays encode the desired shape, while parameters control the number of price bars and the pattern’s vertical scale; a negative scale searches for an inverted form. The examples show plotting similarity values across different pattern lengths and scales, then using a threshold to trigger trades in gold. The approach is presented through Zorro examples, including illustrative pattern definitions and a sample rule that opens long and short positions when a similarity measure exceeds a set level.

The material explains implementation mechanics but provides no reported performance analysis or evidence that the example trading rule is profitable. It does not establish how to select patterns, calibrate thresholds, handle transaction costs, or prevent overfitting. The sample code is therefore best understood as a demonstration of pattern matching and a starting point for testing, rather than a validated strategy.

Key ideas

  • The Fréchet distance compares a price path with a predefined pattern shape.
  • Pattern arrays define the sequence to detect and end with a zero marker.
  • Timeframe and scale parameters adjust the pattern’s horizontal length and vertical size.
  • Negative scale values allow searches for vertically inverted patterns.
  • The sample gold strategy uses a similarity threshold, but the document gives no evidence of profitability.

Tags

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