Mastering Financial Pattern Recognition

Book description

Candlesticks have become a key component of platforms and charting programs for financial trading. With these charts, traders can learn underlying patterns for interpreting price action history and forecasts. This A-Z guide shows portfolio managers, quants, strategists, and analysts how to use Python to recognize, scan, trade, and back-test the profitability of candlestick patterns.

Financial author, trading consultant, and institutional market strategist Sofien Kaabar shows you how to create a candlestick scanner and indicator so you can compare the profitability of these patterns. With this hands-on book, you'll also explore a new type of charting system similar to candlesticks, as well as new patterns that have never been presented before.

With this book, you will:

  • Create and understand the conditions required for classic and modern candlestick patterns
  • Learn the market psychology behind them
  • Use a framework to learn how back-testing trading strategies are conducted
  • Explore different charting systems and understand their limitations
  • Import OHLC historical FX data in Python in different time frames
  • Use algorithms to scan for and reproduce patterns
  • Learn a pattern's potential by evaluating its profitability and predictability

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Why This Book?
    2. Target Audience
    3. Conventions Used in This Book
    4. Using Code Examples
    5. O’Reilly Online Learning
    6. How to Contact Us
    7. Acknowledgments
  2. 1. Importing and Processing Financial Data in Python
    1. Installing the Environment
    2. Creating the Importing Algorithm 
    3. Putting It All Together
    4. Summary
  3. 2. Algorithmic Mindset and Functions
    1. Coding the Primal Functions 
      1. The Function to Add Columns to an Array
      2. The Function to Delete Columns from an Array
      3. The Function to Add Rows to an Array
      4. The Function to Remove Rows from an Array
      5. The Function to Round Numbers
    2. Coding Signals
    3. Creating the Signal Charts
    4. Coding Performance Evaluation Functions
      1. The Hit Ratio
      2. The Rate of Return
      3. The Profit Factor
      4. The Risk-Reward Ratio
      5. The Number of Trades
      6. Creating a Performance Evaluation Function
      7. A Hypothetical Example: Appraising Performance
  4. 3. Introducing Technical Analysis
    1. Charting Analysis
    2. Indicator Analysis
      1. Moving Averages
      2. The Relative Strength Index
    3. Pattern Recognition
    4. Common Pitfalls of Technical Analysis
      1. Wanting to Get Rich Quickly
      2. Forcing the Patterns
      3. Hindsight Bias, the Dream Smasher
      4. Assuming That Past Events Have the Same Future Outcome
      5. Making Things More Complicated Than They Need to Be
    5. Technical Analysis Best Practices
      1. Harness the Power of Different Time Frames
      2. Use More Than One Strategy or Indicator
      3. Choose the Right Type of Strategy for Current Market Conditions
      4. Don’t Underestimate Default Parameters
  5. 4. Classic Trend-Following Patterns
    1. The Marubozu Pattern
    2. The Three Candles Pattern
    3. The Tasuki Pattern
    4. The Three Methods Pattern
    5. The Hikkake Pattern
  6. 5. Modern Trend-Following Patterns
    1. The Quintuplets Pattern
    2. The Double Trouble Pattern
    3. The Bottle Pattern
    4. The Slingshot Pattern
    5. The H Pattern
  7. 6. Classic Contrarian Patterns
    1. The Doji Pattern
      1. The Dragonfly Doji
      2. The Gravestone Doji
      3. The Flat Doji
      4. The Double Doji
      5. The Tri Star Doji
    2. The Harami Pattern
    3. The On Neck Pattern
    4. The Tweezers Pattern
    5. The Stick Sandwich Pattern
    6. The Hammer Pattern
    7. The Star Pattern
    8. The Piercing Pattern
    9. The Engulfing Pattern
    10. The Abandoned Baby Pattern
    11. The Spinning Top Pattern
    12. The Inside Up/Down Pattern
    13. The Tower Pattern
  8. 7. Modern Contrarian Patterns
    1. The Doppelgänger Pattern
    2. The Blockade Pattern
    3. The Euphoria Pattern
    4. The Barrier Pattern
    5. The Mirror Pattern
    6. The Shrinking Pattern
  9. 8. Advanced Candlestick-Charting Systems
    1. Heikin-Ashi System
      1. Detecting the Doji Pattern
      2. Detecting the Tasuki Pattern
      3. Detecting the Euphoria Pattern
      4. Detecting the Double Trouble Pattern
    2. K’s Candlesticks System
      1. Detecting the Doji Pattern
      2. Detecting the Tasuki Pattern
      3. Detecting the Euphoria Pattern
      4. Detecting the Double Trouble Pattern
  10. 9. Candlestick Patterns Exit Techniques
    1. The Symmetrical Exit Technique
    2. The Fixed Holding Period Exit Technique
    3. The Variable Holding Period Exit Technique
    4. The Hybrid Exit Technique
    5. Pattern Invalidation
  11. 10. Candlestick-Based Trend-Following Strategies
    1. Combining the Double Trouble Pattern with the RSI
    2. Combining the Three Candles Pattern with Moving Averages
    3. Combining the Bottle Pattern with the Stochastic Oscillator
    4. Combining the Marubozu Pattern with K’s Volatility Bands
    5. Combining the H Pattern with the Trend Intensity Index
  12. 11. Candlestick-Based Contrarian Strategies
    1. Combining the Doji Pattern with the RSI
    2. Combining the Engulfing Pattern with Bollinger Bands
    3. Combining the Piercing Pattern with the Stochastic Oscillator
    4. Combining the Euphoria Pattern with K’s Envelopes
    5. Combining the Barrier Pattern with the RSI-ATR
  13. 12. Risk Management and Trading Psychology
    1. Basics of Risk Management
      1. Stops and Targets
      2. Trailing Stops
      3. Position Sizing
      4. Economic Calendar
    2. Behavioral Finance: The Power of Biases
      1. Cognitive Biases
      2. Emotional Biases
    3. Trading Framework
  14. Index
  15. About the Author

Product information

  • Title: Mastering Financial Pattern Recognition
  • Author(s): Sofien Kaabar
  • Release date: October 2022
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098120474