« Back home

Heikin-ashi combined with stochastic indicator

Heikin-ashi charts are a variation to the regular candlestick chart. The only difference between the two charts are that instead of using the open-high-low-close (OHLC) bars like standard candlestick charts, the Heikin-Ashi chart is constructed by taking the averages of the previous day’s value. All the candlestick patterns apply to Heikin-ashi charts as well.

The strategy involves converting the time series data into Heikin-ashi charts and further combining the Heikin-ashi chart with a simple stochastic indicator to generate buy and sell signals. Please note, HAC refers to Heikin-ashi charts and SOPK/SOPD refers to a standard stochastic function.

Buy script

Sell script

Additional notes

The OHLC for Heikin –ashi is calculated as follows -
Close = (Open + High + Low + Close) / 4
Average price of the current bar
Open = [Open (Previous Bar) + Close (Previous Bar)]/2
Midpoint of the previous bar
High = Max (High, Open, Close)
Highest value in the set
Low = Min (Low, Open, Close)
Lowest value in the set