Is Heikin Ashi calculation correct?
iuliancioarca opened this issue · 0 comments
iuliancioarca commented
Please refer to: https://www.mssqltips.com/sqlservertip/7230/build-heikin-ashi-charts-in-excel-based-on-financial-time-series-data/
HA_close = (open_current + high_current + low_current + close_current)/4
HA_open = (HA_open_prior + HA_close_prior)/2
HA_high = maximum of (high_current, HA_open_current, or HA_close_current)
HA_low = minimum of (low_current, HA_open_current, or HA_close_current)
The hao is calculated as average of previous Heikin Ashi Open and Close, not the original OHLC data.
hac = mean(matr; dims=2)
hao = Vector{Float64}(undef, length(hac))
hao[1] = open[1]
for i=2:length(hac)
hao[i] = (hao[i-1]+hac[i-1])/2
end
hah = max.(hao, hac, matr[:,2])
hal = min.(hao, hac, matr[:,3])