This repository contains a sample notebook that uses FinSpace to backtest price action trading pattern "Head and Shoulders", referred to as HS.
The price action notebook shows the workflow of loading trade and quote data and identifying price action patterns. It covers the following steps:
Load raw security price data into FinSpace for further processing and analysis.
Select the desired trading frequency
Prepare data for the pattern identification algorithm/model
Run the algorithm/model to identify the price action patterns
Plot the pattern on the price chart for verification
The steps below show how to run the Jupyter notebook in managed Amazon FinSpace Spark cluster to perform price action analysis on the HS pattern:
- Load “US Equity TAQ - AMZN 6 Months” data provided as part of the Capital Markets Sample Data Bundle installed in the Amazon FinSpace environment by default.
- Aggregate the price data at various lower frequencies and identify the ones for which the price action patterns are pronounced and tradable.
- Further aggregate the data to the desired frequency by calling FinSpace functions such as time bar collection, summarization, filling, and filtering.
- Smooth the resultant price series using functions provided in FinSpace analytical library (e.g., Exponential Moving Average)
- Find all the local minima and maxima of the smoothed price series, then identify both HS and Inverse HS (IHS) patterns.
- Plot all the identified HS and IHS patterns in the price series chart.
This notebook demonstrates how to perform Price Action Analysis using FinSpace and PySpark. You can use it as a foundation to backtest price action trading patterns of your interest.