Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

68
Views
in javascript I want to creat a simple few lines function to get Heikin-Ashi from close high low open

This question if about javascript (not pyhton or pine script).

I just want to create a simple few lines function => "convert" FROM regular open, high, low and close from an exchange TO a Heikin Ashi

variables open, high, low, close are from an exchange API that return an array with regual candlesticks

here the formula

ha_open = (last_ha_open - last_ha_close) / 2;
ha_close = (open + high + low + close)/4;
ha_high = max(high, ha_open, ha_close);
ha_low = min(low, ha_open, ha_close);

where I get "stuck" is the "last_ha_open" and "last_ha_close"

**** it's easy to save ha_open and ha_close with .push into an array

**** it's easy to retrieving them with array[(array.length -1)] (last of array)

**** it's where it gets tricky... : the infinite loop of calculate the first in the chain.. if wrong, the values don't match...

is there a javascript way to do this ????

Notes i could find about Heikin-ashi

Obs:
The first Heikin-Ashi close equals the average of the open, high, low and close ((O+H+L+C)/4).
The first Heikin-Ashi open equals the average of the open and close ((O+C)/2).
The first Heikin-Ashi high equals the high and the first Heikin-Ashi low equals the low.
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!