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

276
Vistas
Node js : find the same RSI as tradingview

the following code works but does not give me the same value as on tradingview. I don't understand the problem

                var rsi_gain = 0;
                var rsi_loss = 0;

                for (let i = 18; i <= 20; i++) {
                    
                    rsi_gain += (content[i][4] > content[i - 1][4]) ? (content[i][4] - content[i - 1][4]) : 0;
                    rsi_loss += (content[i][4] < content[i - 1][4]) ? (content[i - 1][4] - content[i][4]) : 0;

                }
                
                
                // Calcul Average Gain
                var AVG_gain = (rsi_gain / 3); // (Gains / Periode)


                // Calcul Average Loss
                var AVG_loss = (rsi_loss / 3); // (Pertes / Periode)
   
                
                //RS
                var RS = (AVG_gain / AVG_loss);
         
                
                //RSI
                var RSI = 100 - (100 / (1 + RS));

My result with these values (48979.05,48861.92,48964.83) : 53.23 Tradingview result : 62.61

image : https://www.zupimages.net/viewer.php?id=21/51/y7ik.jpeg

Thank you

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The first N bars (length) are calculated by using a simple moving average, afterwards you have to apply a exponential average.

https://www.tradingview.com/pine-script-reference/v5/#fun_ta{dot}rsi

https://www.tradingview.com/pine-script-reference/v5/#fun_ta{dot}rma

about 4 years ago · Santiago Trujillo Denunciar
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