Understanding AI Pattern Recognition for Trading
Pattern Detection
Let's open this discussion with the following question: How can you detect patterns in trade data and use these to automate decisions for trading? Traditionally traders have used indicators and patterns in a price time series to find trading opportunities through technical analysis of stock charts. New deep learning methods have made it possible to extract complex relationships in the price and volume movements that are differentiated from some of these traditional methods and can provide advantageous new signals. Traders look for price patterns that signal changes in the market's trend, and then execute trades based on these signals. AI can process vast amount of data to recognize patterns and trends that can inform trading decisions which a human might not be able to detect. AI is transforming many areas especially with automation, and some places have already started to incorporate these new techniques into their platforms.
There are a plethora of patterns that can be programmatically defined and identified including Head and Shoulders, Cup and Handle, Double Top/Bottom, and Triangle that indicate bullish or bearish market sentiments. You can write a machine learning program to find these patterns on a price series and report how often the market had a swing in a positive or negative direction and the size of that movement, and the duration of that trend for a swing style strategy.
You can generate a frequency report of how often these patterns were detected, but need to determine which do a better job at predicting trends in a positive or negative direction. I offer a few illustrations in the slide below.
Back Testing
A back-test is a way to consolidate indicators together into a strategy with buy and sell signals. In this rather simplistic example below, I will discuss how you can add a pattern into a back-test.
Back Testing -- A Simple Example
Bullish Engulfing pattern -- A bullish engulfing pattern happens when the current candlestick's real body completely engulfs the previous candlestick's body, with the current candle closing higher than the previous candle's high, and opening lower than the previous candle's low. Here is a visual of the pattern:
You can add this signal as a buy event with a profit taking condition to see cumulative P&L, drawdowns including max drawdown, and other factors like Sharpe Ratio. During algo trading back-testing, a higher Sharpe Ratio indicates that a strategy is providing more return per unit of risk, making it a crucial metric for comparing different strategies or pattern indicators. There are various visuals and reports that are available to see the buy and sell events in your historical data:
领英推荐
New Methods: Increasing Pattern Complexity and LSTM for Price Predictions
In recent years, LSTMs have been proposed as alternative ways to create price predictions on stock price series data with ongoing research on their effectiveness. A "lagged LSTM price prediction" refers to using a Long Short-Term Memory (LSTM) neural network to predict future prices of a financial asset by incorporating past price data at specific lagged time intervals as input into the model, allowing it to capture complex relationships and trends within the time series data. This has been a controversial topic, so I discuss how this is done on a high level and some initial first readings.
Lag Feature engineering: Before feeding data to the LSTM, the historical data is transformed into lagged features, meaning you create new features by shifting the original price data by a certain number of time steps (for example, daily and weekly shifts). Those that are familiar with ARIMA models might be familiar with how to create these, and you can compare to see which one performed better.
Why LSTM?
Businesses that are Incorporating Pattern Detection for Day Traders
Many places are incorporating AI and sophisticated methods for pattern detection and algo development which is making it easier to develop strategies, and evaluate results. Some examples are provided below.
Tickeron -- AI powered stock forecast tools -- https://tickeron.com
Trendspider -- Train predictive AI-based trading models -- https://trendspider.com
Meet Composer -- Build trading algorithms with AI, backtest them, then execute—all in one platform. https://www.composer.trade/
Enjoy and happy back-testing. I have a presentation from which some of the images are taken on this that breaks this into simple and easier to understand ideas. Ask for more info.