Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

80
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda