# Stochastic with Heikin Ashi Close

My understanding is stochastic oscillator is calculated by subtracting the low for the period from the current closing price, dividing by the total range for the period and multiplying by 100. As a hypothetical example, if the 14-day high is \$150, the low is \$125 and the current close is \$145, then the reading for the current session would be: (145-125)/(150-125)*100, or 80.

I need to give Close price based on Heikin Ashi Close instead of normal close price. Is it possible to refine code that takes value from Heikin Ashi Chart instead of normal close price

You can just assign your arrays to the AB defined arrays and use them.
Once you're done, just restore them.

Explained here in detail
http://www.amibroker.com/kb/2014/11/04/indicators-based-on-user-values/

1 Like

@raahularya, an alternative to @travick method is to define the function yourself.

Since you have not posted any code (with code tags) I can only assume that you are defining your HA chart values, so you would have Heikin Ashi Close value of something like HAC.

Using that (HAC) you can then do your Stochastic Calculation and have the vale you want (code below untested).

``````HAStochH = HHV(HAC, 14);
HAStochL = LLV(HAC, 14);
HAStoch = (HAC - HAStochL)/(HAStochH - HAStochL) * 100;
``````