Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

78
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda