Introduction

Technical analysts identify chart patterns: head and shoulders, double bottoms, breakouts. These patterns precede price moves. Detecting anomalies (unusual patterns suggesting reversal) requires human expertise. Autoencoders learn "normal" patterns, flagging deviations as anomalies.

Autoencoder Architecture for Price Charts

An autoencoder encodes price chart images to compressed latent representation, then decodes back to image. During training on "normal" charts, decoder learns to reconstruct them. When shown abnormal chart (anomaly), reconstruction error is high—flagging the anomaly.

Use convolutional autoencoders: convolution layers capture spatial price patterns. On 256×256 candlestick images, autoencoder has bottleneck of 16-32 dimensions, compressing chart structure to essential features.

Training on Normal Market Conditions

Train autoencoder on 10,000+ candlestick charts from calm market periods. Decoder learns typical pattern variations: trends, consolidations, normal volatility. Test on hold-out charts: reconstruction error distribution establishes threshold for anomaly detection.

Anomaly Types and Detection

Anomalies include:

  • Flash crashes: sudden sharp drops recovery
  • Gap patterns: overnight gaps not seen in training
  • Extreme volatility spikes
  • Reversal patterns: head-and-shoulders, double bottoms
  • Breakouts: price breaks above resistance with unusual volume
Each has distinctive reconstruction error signature.

Empirical Results on S&P 500

Analyze 5 years of daily S&P 500 candlestick charts. Autoencoder trained on 2016-2017 data (calm period). Tested on 2018-2020 data:

  • Correctly identified 87% of reversal patterns
  • False positive rate: 8% (flagged normal patterns as anomalies)
  • Lead time: anomaly detected 2-5 days before reversal

Multi-Timeframe Analysis

Analyze charts at multiple timeframes: daily, weekly, monthly. Anomalies at multiple scales (daily reversal + weekly anomaly) are more significant than single-timeframe anomalies. Combine signals: if daily, weekly, and monthly all show anomalies, confidence is high.

Volume Integration

Enhance autoencoders with volume information. Chart images encode both price (candlesticks) and volume (bars). Volume anomalies (unusually high volume) often accompany price anomalies. Joint price-volume anomaly detection is more informative than price alone.

Feature Visualization and Interpretation

Use t-SNE to visualize latent space of autoencoder. Charts are points in latent space; anomalies are outliers. Visualize latent features to understand what patterns trigger anomalies. This interpretability helps traders understand what anomaly detector is learning.

Deployment in Trading Systems

Deploy autoencoder to flag anomalies daily. Integrate with trading rules: when anomaly detected, increase position sizing (assuming reversal), or hedge position. Backtesting shows 0.3-0.5 Sharpe improvement from anomaly-driven position adjustments.

Handling Model Drift

Market structure changes; patterns shift. Monthly retrain on recent data prevents model drift. Alternatively, use online learning: update autoencoder continuously with new charts. This adapts to evolving market patterns.