anandanand84 / technicalindicators

A javascript technical indicators written in typescript with pattern recognition right in the browser
MIT License
2.15k stars 557 forks source link

What is the "period" option for? #125

Closed ThatBrianDude closed 6 years ago

ThatBrianDude commented 6 years ago

Is it supposed to set the time period? Is it in minutes, hours or days?

Say I want to calculate the hourly RSI with a given array of values (each representing the price at that hour).

What should the period option be? 60?

anandanand84 commented 6 years ago

Period is not hours or days or minutes, its the number of bars, if you send hourly data it is hourly, if you send daily data it is for days.

Period is a required parameter used to calculate RSI. Usually people use 14.

ThatBrianDude commented 6 years ago

So it should be the exact count of values I provide?

If I provide 24 values (1 day) then I set the period to 24 to get an RSI for each value?

Also, do I provide RSI with close values or something else?

anandanand84 commented 6 years ago

No. It is difficult to explain. I would suggest you to read https://www.tradingview.com/wiki/Moving_Average and https://www.tradingview.com/wiki/Relative_Strength_Index_(RSI) to learn the basics of technical indicators and RSI