Candlestick charts pack data into time increments called bars to view what the trends were over that time frame. The candlestick itself shows the direction and magnitude of the price change during that time bar by capturing OHLC (open low high close) data. The direction of the movement over that time bar determines if it is a bearish or bullish candle.

The candlesticks can be grouped together in detectable patterns that are precursors to events like increased momentum, trend reversal, and an extension of continued trend. They can be used in this way to predict various events that occur intra-day during trading. In summary, here are just some of the things that candle stick patterns can help predict:

**Reversal**– The change in price direction**Continuation**– extension time in the current price direction**Momentum**– Rate of acceleration in the trade price

Candlesticks can be grouped together to form patterns which can be evaluated for the predictive content of the events above. You need to be careful when lining up the dependent and independent variables on the time series so you don’t mix future and current state observations. There are several known candlestick patterns which are known to be precursors for trend reversals. Here are just a couple of which various sources indicate predictions of reversal accuracy of over 70%:

When we speak of fractals in the trading sense it is the detection of these markers that can be indicative of some future price action. We have reviewed some of the fractals that are known like the evening star and the three line strike, but how does one detect fractal patterns in your data?

This is where fractal pattern algorithms come into play. You can write a fractal pattern recognition program to find market breakouts and reversals. Starting with an OHLC array, a fractal program to function can be developed recursively based on the properties of the fractals you want to capture. A rather simple example of a fractal indicator is below, but they can be much more complex in nature:

def fractals(Data, high, low, buy, sell):
**# Fractal up – bullish breakout signal**
for i in range(len(Data)):
if Data[i, high] < Data[i – 2, high] and Data[i – 1, high] < Data[i – 2, high] and Data[i – 2, high] > Data[i – 3, high] and Data[i – 2, high] > Data[i – 4, high]:
Data[i – 2, buy] = 1
**# Fractal down – bearish breakout signal**
for i in range(len(Data)):
if Data[i, low] > Data[i – 2, low] and Data[i – 1, low] > Data[i – 2, low] and Data[i – 2, low] < Data[i – 3, low] and Data[i – 2, low] < Data[i – 4, low]:
Data[i – 2, sell] = -1

Usually fractals can be used alongside other indicators to contribute to an overall trading strategy. You will want to add them to a back-testing program as a signal and measure the overall strategy performance like average drawdown and Sharpe Ratio. These tools have nice plotting features that visual your fractal indicator in relations to what happened to next. You can use Quant Strat in R or similar tools in Python for visualization like below:

This is just an overview of how you could use fractal patterns in trading to build strategies, but this is not a comprehensive and exhaustive analysis. We have incorporated some in our trading strategies, but that work is not highlighted here. The purpose is to give the reader an example of how you could work fractals on time series data, and provide the reader enough information to get started on building their own.

## Comentários