Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

RSI Divide by zero issue #27

Closed
ghost opened this issue Jan 25, 2015 · 1 comment
Closed

RSI Divide by zero issue #27

ghost opened this issue Jan 25, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 25, 2015

Hi,

Perhaps I'm misunderstanding how to use things here, but when I do the following:

closePriceIndicator = new ClosePriceIndicator(timeSeries);
rsiIndicator = new RSIIndicator(closePriceIndicator, 5);

Then proceed to call "getValue();" I get:

rsiIndicator.getValue(0); // 0;
rsiIndicator.getValue(1); // Divide by zero exception.

The data in my closePriceIndicator is fine and works as expected. I'm expecting values between 0 and 100 that correspond to the RSI Values at the respective dates.

I'm using the jar from maven central: ta4j-0.5

Thanks!

@mdeverdelhan
Copy link
Owner

Hi,

Already noticed in #16. I recommend you to use the 0.6-SNAPSHOT.

Anyway thank you for using ta4j. :)

gcauchis pushed a commit to gcauchis/ta4j that referenced this issue Oct 31, 2017
* Changed package description regarding issue mdeverdelhan#13

The package description has been changed from eu.verdelhan.ta4j
to org.ta4j.core in main and test.

* Changed package description regarding issue mdeverdelhan#13 (cannot handle intellij)

Rest of files for previous commit.
(The package description has been changed from eu.verdelhan.ta4j
to org.ta4j.core in main and test.)

* Modify pom.xml of parent, core and ta4j-examples

* Change artifact name to ta4j-core

* Added DirectionalMovementPlus and -MinusIndicator to new package for adx

in issue mdeverdelhan#27 it became clear that adx/admi was a little bit hard to use
because of the an alternative calculation.
I have not changed the calculation but added two new indicators with
test clases, that are usually used in combination with the adx.
Additional the established indicators were moved to the new package
"adx" to make clear where to find them and how they are to use in this
library

* Fix AroonDownIndicator, AroonUpIndicator and NaN value support (mdeverdelhan#25)

Fix AroonDownIndicator, AroonUpIndicator
Added AroonOscillatorIndicator
NaN value support (for AroonIndicators)

* Update Chancelog

* Clear code after merge

* Fix AroonDownIndicatorTest (maxPrice was used instead of minPrice)

* Update CHANGELOG.md

* Introduce "IsEqualRule" (mdeverdelhan#38)

* Create IsEqualRule.java

* Create IsEqualRuleTest.java

* Update IsEqualRule.java

* Update IsEqualRule.java

* Update IsEqualRuleTest.java

* Update IsEqualRule.java

* Update IsEqualRule.java

* Update IsEqualRuleTest.java

* Update CHANGELOG.md

* removed unnecessary last tick index calculation if the ticks list is empty (mdeverdelhan#44)

* Introduce "InSlopeRule" (mdeverdelhan#41)

"InSlopeRule" tests positive and negative slopes between two values of indicators.
* Create InSlopeRule.java
* Create InSlopeRuleTest.java
* Update InSlopeRule.java
* Update InSlopeRuleTest.java
* Update Changelog.md

* Add new constructor to AroonUpIndicator and AroonDownindicator. (mdeverdelhan#47)

Default stays minPriceIndicator and maxPriceIndicator, with new constructor
the user gets the possibility to hand over custom indicator for min and
max price calculation

* New Rules: Falling/Rising/Highest/Lowest-IndicatorRules (mdeverdelhan#48)

* Add files via upload

* Add files via upload

* Update CHANGELOG.md

* Update IsFallingRule.java

* Update IsHighestRule.java

* Update IsLowestRule.java

* Update IsRisingRule.java

* Update IsFallingRule.java

* Add files via upload

* Add files via upload

* Update IsFallingRule.java

* Update IsRisingRule.java

* Update CHANGELOG.md

* Update IsHighestRule.java

* Update IsLowestRule.java

* Update IsLowestRule.java

* Update IsHighestRule.java

* Added toString()

* Update AroonUpIndicator.java

* added toString()

* Update DoubleEMAIndicator.java

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* updated toString()

* added toString()

* added toString()

* added toString()

* Update SmoothedRSIIndicator.java

* Update AverageDirectionalMovementIndicator.java

please use "code formatter"

* Update DirectionalMovementMinusIndicator.java

please use code formatter

* Update DirectionalMovementPlusIndicator.java

please use code formatter

* Update IsRisingRuleTest.java

* Update IsFallingRuleTest.java

* Added constructor with default values

For this indicator standard values for long/shortTimeframes exist.
As described, e.g. in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:coppock_curve, default timeFrame-settings exist. I added them.

* Update CoppockCurveIndicator.java

* Update CoppockCurveIndicator.java

* Update SmoothedRSIIndicator.java

* no need to overwrite toString

no need to overwrite toString, because there is no "timeFrame"-property.

* Prepare Repository for next maven release (0.10-SNAPSHOT)

- Rename directory ta4j to ta4j-core
- Update pom.xml
- Update ta4j-core/pom.xml
- Update ta4j-examples/pom.xml
- Update imports of ta4j-examples to new repository
gcauchis pushed a commit to gcauchis/ta4j that referenced this issue Oct 31, 2017
* Changed package description regarding issue mdeverdelhan#13

The package description has been changed from eu.verdelhan.ta4j
to org.ta4j.core in main and test mdeverdelhan#13 

* Modify pom.xml of parent, core and ta4j-examples

* Change artifact name to ta4j-core

* Added DirectionalMovementPlus and -MinusIndicator to new package for adx

in issue mdeverdelhan#27 it became clear that adx/admi was a little bit hard to use
because of the an alternative calculation.
I have not changed the calculation but added two new indicators with
test classes, that are usually used in combination with the adx.
Additional the established indicators were moved to the new package
"adx" to make clear where to find them and how they are to use in this
library

* Fix AroonDownIndicator, AroonUpIndicator and NaN value support (mdeverdelhan#25)

Fix AroonDownIndicator, AroonUpIndicator
Added AroonOscillatorIndicator
NaN value support (for AroonIndicators)

* Fix AroonDownIndicatorTest (maxPrice was used instead of minPrice)

* Introduce "IsEqualRule" (mdeverdelhan#38)

* Create IsEqualRule.java

* Create IsEqualRuleTest.java

* Update IsEqualRule.java

* Update IsEqualRule.java

* removed unnecessary last tick index calculation if the ticks list is empty (mdeverdelhan#44)

* Introduce "InSlopeRule" (mdeverdelhan#41)

"InSlopeRule" tests positive and negative slopes between two values of indicators.
* Create InSlopeRule.java
* Create InSlopeRuleTest.java

* Add new constructor to AroonUpIndicator and AroonDownindicator. (mdeverdelhan#47)

Default stays minPriceIndicator and maxPriceIndicator, with new constructor
the user gets the possibility to hand over custom indicator for min and
max price calculation

* New Rules: Falling/Rising/Highest/Lowest-IndicatorRules (mdeverdelhan#48)


* Update IsLowestRule.java

* Update IsHighestRule.java

* Added toString()

* Update AroonUpIndicator.java

* added toString()

* Update DoubleEMAIndicator.java

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* added toString()

* updated toString()

* added toString()

* added toString()

* added toString()

* Update SmoothedRSIIndicator.java

* Update AverageDirectionalMovementIndicator.java

please use "code formatter"

* Update DirectionalMovementMinusIndicator.java

please use code formatter

* Update DirectionalMovementPlusIndicator.java

please use code formatter

* Update IsRisingRuleTest.java

* Update IsFallingRuleTest.java

* Added constructor with default values

For this indicator standard values for long/shortTimeframes exist.
As described, e.g. in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:coppock_curve, default timeFrame-settings exist. I added them.

* Update CoppockCurveIndicator.java

* Update CoppockCurveIndicator.java

* Update SmoothedRSIIndicator.java

* no need to overwrite toString

no need to overwrite toString, because there is no "timeFrame"-property.

* Prepare Repository for next maven release (0.10-SNAPSHOT)

- Rename directory ta4j to ta4j-core
- Update pom.xml
- Update ta4j-core/pom.xml
- Update ta4j-examples/pom.xml
- Update imports of ta4j-examples to new repository

* Feature: Pivot Point Indicator (mdeverdelhan#49)

New Package for pivot calculation.
New Indicator for calculating the pivot point pp and reversals s3, s2,
s1, r1, r2 and r3.
New Indicators for calculating the fibonacci reversals s3, s2, s1, r1,
r2 and r3.
Added test file

FibonacciPivotResistance1Indicator.java
FibonacciPivotResistance2Indicator.java
FibonacciPivotResistance3Indicator.java
FibonacciPivotSupport1Indicator.java
FibonacciPivotSupport2Indicator.java
FibonacciPivotSupport3Indicator.java
PivotPointIndicator.java
PivotResistance1Indicator.java
PivotResistance2Indicator.java
PivotResistance3Indicator.java
PivotSupport1Indicator.java
PivotSupport2Indicator.java
PivotSupport3Indicator.java
PivotPointIndicatorTest.java

* PivotPointsIndicator and Indicators for reversals (standard/fibonacci)

New Package for pivot calculation.
New Indicator for calculating the pivot point pp and reversals s3, s2,
s1, r1, r2 and r3.
New Indicators for calculating the fibonacci reversals s3, s2, s1, r1,
r2 and r3.
Added test file

FibonacciPivotResistance1Indicator.java
FibonacciPivotResistance2Indicator.java
FibonacciPivotResistance3Indicator.java
FibonacciPivotSupport1Indicator.java
FibonacciPivotSupport2Indicator.java
FibonacciPivotSupport3Indicator.java
PivotPointIndicator.java
PivotResistance1Indicator.java
PivotResistance2Indicator.java
PivotResistance3Indicator.java
PivotSupport1Indicator.java
PivotSupport2Indicator.java
PivotSupport3Indicator.java
PivotPointIndicatorTest.java

* PivotPointsIndicator and Indicators for reversals (standard/fibonacci)

New Package for pivot calculation.
New Indicator for calculating the pivot point pp and reversals s3, s2,
s1, r1, r2 and r3.
New Indicators for calculating the fibonacci reversals s3, s2, s1, r1,
r2 and r3.
Added test file

FibonacciPivotResistance1Indicator.java
FibonacciPivotResistance2Indicator.java
FibonacciPivotResistance3Indicator.java
FibonacciPivotSupport1Indicator.java
FibonacciPivotSupport2Indicator.java
FibonacciPivotSupport3Indicator.java
PivotPointIndicator.java
PivotResistance1Indicator.java
PivotResistance2Indicator.java
PivotResistance3Indicator.java
PivotSupport1Indicator.java
PivotSupport2Indicator.java
PivotSupport3Indicator.java
PivotPointIndicatorTest.java

* Summarise the standard and fibonacci reversal indicators

* Add DeMarkPivotPointIndicator and DeMarkReversalIndicator

* Pivotpoints Package: Remove redundancy and make type safe by using enums

* Fix DeMarkPivotReversalIndicator, added test file cases, extend comment

I used
     decimalValue.min(decimalValue)
instead of
    decimalValue.minus(decimalValue)   -.-

Now, all calculations are correct.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant