Help to implement RVGI indicator , NaN values
See original GitHub issueHello all , i have a question , i create the next code :
values = {
'open': np.array([]),
'high': np.array([]),
'low': np.array([]),
'close': np.array([]),
'volume': np.array([]),
}
for x in candles:
if 'active_id' in candles[x].keys():
actualPrice = candles[x]['close']
values['open'] = np.append(values['open'], candles[x]['open'])
values['high'] = np.append(values['high'], candles[x]['max'])
values['low'] = np.append(values['low'], candles[x]['min'])
values['close'] = np.append(values['close'], candles[x]['close'])
values['volume'] = np.append(values['volume'], candles[x]['volume'])
serieOpen = pd.Series(values['open'])
serieHigh = pd.Series(values['high'])
serieLow = pd.Series(values['low'])
serieClose = pd.Series(values['close'])
resultRVI = ta.rvgi(serieOpen, serieHigh, serieLow, serieClose)
But when i print “resultRVI” i got this :
RVGI_14_4 RVGIs_14_4
0 NaN NaN
1 NaN NaN
2 NaN NaN
3 NaN NaN
4 NaN NaN
5 NaN NaN
6 NaN NaN
7 NaN NaN
8 NaN NaN
9 NaN NaN
10 NaN NaN
11 NaN NaN
12 NaN NaN
13 NaN NaN
14 NaN NaN
The question is why i recibe NaN values , i cant understand , some one can help me please 😭
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Relative Vigor Index - 2 Top Trading Strategies You Can Use
Relative Vigor Index is a two line oscillator that helps determine trend and momentum. Learn 2 great strategies that use the RVI and...
Read more >Implementing the Relative Vigor Index and Backtesting a ...
In this article, we will first build some basic intuitions about the indicator and the mathematics behind it. Then, we will proceed to...
Read more >Relative Vigor Index (RVI): Definition, Formula, Uses in ...
The Relative Vigor Index (RVI) measures the strength of a trend by comparing a closing price to the daily range.
Read more >Pandas TA: A Technical Analysis Library in Python 3 - Morioh
Use help(ta.indicator_name) for more information or make a Pull Request to ... this value to 0. df.ta.cores = 4 # Maybe you do...
Read more >5 Trading Strategies Using the Relative Vigor Index
The relative vigor index (RVI or RVGI) is a technical indicator that ... above and below zero – producing both positive and negative...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kypanz,
I can not create an IQ Option account from the US and will not be able to test their output that you get. You will have to manage the data from that unofficial iqoption api yourself.
I know how rvgi works. The signal B is a lagged version of A and will not start calculating till A has started.
I can not access to how IQOptions calculates rvgi nor view it’s source. So if there are differences in computation between their closed system (and graphics values) and this open source version, then that is beyond my control without insight into their source. It is not uncommon for different platforms to have slight variations in calculations. Even the de facto TA Lib in C they sometimes have different calculations by platform.
Unfortunately, I can not devote much time on a one off difference in computation without further evidence. There is clearly a lack of data to reasonably test this information both for one off differences and a test of correlation between IQOptions calculation and Pandas TA versions of rvgi. Somehow you need to be able to export both their candles and their rvgi data so that it can be more easily compared. Now it is possible that swma could be throwing the values off, but yet again you do not have data for comparison, just a “graphics value”.
When you are able to give me more actionable data to work with, I can look into it.
Kind Regards, KJ
Hi @kypanz,
IQOption returns exactly what you shared below, including the
defaultdict(<class 'dict'>, ...
? Or are you creating yourcandles
variable as adefaultdict
? What is the actual data you get? Where is link to IQOption API data? I want to see the actual source they return.Also, rvgi requires by default a minimum of 14 candles, but 15 candles to write it’s first value. This goes for most indicators that have rolling windows. So with only 14 candles, the first 14 candles of rvgi will be
NaN
. In short, trying using more data or shortening the lengths of your indicators.When I strip the
defaultdict(<class 'dict'>, ...)
that you have provided, convert it to a Pandas DataFrame and adjust the rvgi length to 12, I get data. Here is the code:Output
Also note, you will also need to convert your index into a DatetimeIndex if you want to use other indicators like vwap.
Let me know how it goes. Hope this helps!
Thanks, KJ