Closed ThomasPelster closed 3 years ago
Hi,
The RSI function takes length times the gain/loss of the 8 values, this results in 7 values.
The only functions affected by this method of calculation are the RSI, WRSI functions. Other functions like the smoothed moving average require a value to base the next results on.
I didn't think this would cause any issues as the data is provided "raw" in the function.
@Vultwo Thanks for your fast reply.
I have no finance mathematics background, so the fact that the 6 refers to gain/loss was not clear to me. But that does little to change the current mode of operation, which would have to be adapted.
Test data = [1, 2, 3, 4, 5, 6, 7, 5]; (Number 6 on 6 position!) First run > [ 1, 2, 3, 4, 5, 7] = RSI 100 Second run > [2, 3, 4, 5, 7, 5] = RSI 71.43
The 6 at position 6 is currently skipped. Which means that currently only 5 gain/loss are used.
Test data gets turned into [1,1,1,1,1,1,-2]. Number 6 on position 6 is irrelevant.
Maybe I'm just explaining it too badly :-)
Currently you only calculate: RSI 100 2-1 3-2 4-3 5-4 7-5
RSI 71.43 3-2 4-3 5-4 7-5 5-7
By combining the loops, position 6 is skipped, no matter what number is there.
Correct would be, e.g. 2-1 3-2 4-3 5-4 6-5 7 -6
Aaaah i see what you mean. Damn how could i have missed that. I guess I am just going to push the breaking change, all values are worthless right now. Thanks for the heads up.
Btw its not: "The RSI function takes length times the gain/loss of the 8 values, this results in 7 values." I didn't think I could be wrong as I triple checked all functions.
@Vultwo I googled a bit, the statement with 8 measuring points and thus 7 persiods is correct. So your bugfix solved the problem of skipping a value. But now there are 3 RSI's out of 8 measuring points, there should be only 2
Currently: --> 100 (6 values -> 5 periods) 2-1 3-2 4-3 5-4 6-5
--> 100 3-2 4-3 5-4 6-5 7-6
--> 66.66 4-3 5-4 6-5 7-6 5-7
Correct would be
--> 100 (7 values -> 6 periods) 2-1 3-2 4-3 5-4 6-5 7-6
AND
--> 71.42857142857143 3-2 4-3 5-4 6-5 7-6 5-7
I think I have fixed it now
Hi,
I found this project yesterday and I noticed that the combination of the number of test data and the results are not harmonic.
e. g. RSI: 8 * test data; length 6 ==> BUT only 2 results?
After some research I noticed that the length of the first 'loop' is not adapted to the numbering of lists. The result is that always the 6 number of the test data is skipped.
Without verifying it, I would claim that this effect will be found in many formulas. Therefore, I would classify it as a breaking change and wanted to discuss the bug fixing.