https://github.com/cbrown184/jkeltner
Keltner channel calculator
https://github.com/cbrown184/jkeltner
java keltner-channel keltner-channels trading
Last synced: 6 months ago
JSON representation
Keltner channel calculator
- Host: GitHub
- URL: https://github.com/cbrown184/jkeltner
- Owner: cbrown184
- License: apache-2.0
- Created: 2018-10-23T00:50:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-24T12:13:31.000Z (almost 3 years ago)
- Last Synced: 2025-07-15T05:49:43.587Z (about 1 year ago)
- Topics: java, keltner-channel, keltner-channels, trading
- Language: Java
- Homepage:
- Size: 85 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Keltner Channel Calculator
Big Decimal implementation.
Pure java - no additional libraries.
Works on Java 8 +.
## Description
https://en.wikipedia.org/wiki/Keltner_channel
Keltner Channels are volatility-based bands that are placed on either side of an asset's price and can aid in determining the direction of a trend.
Price reaching the upper Keltner Channel band is bullish, while reaching the lower band is bearish.
The angle of the Keltner Channel also aids in identifying the trend direction. The price may also oscillate between the upper and lower Keltner Channel bands, which can be interpreted as resistance and support levels.
## Installation
```xml
io.github.cbrown184
jkeltner
1.0.2
```
## Usage
```java
JKeltnerCalculator jKeltnerCalculator = new JKeltnerCalculator.JKeltnerBuilder()
// The default moving average (EMA) of a Keltner Channel is 20 periods
.setPeriod(3)
// The upper and lower bands are typically set two times the average true range (ATR) above and below the EMA
.setAtrMultiplier(2)
// Precision of the floating point (BigDecimal) values returned
.setScale(6)
// Smoothing factor of EMA
.setSmoothingFactor(2)
.build();
// Input candle data - high, low, close
// The calculator returns Optional.Empty() until the number of candles supplied is equal to the set period
jKeltnerCalculator.calculate(1.45, 1.41, 1.42); // -> Optional.empty
jKeltnerCalculator.calculate(1.46, 1.42, 1.43); // -> Optional.empty
jKeltnerCalculator.calculate(1.51, 1.41, 1.42); // -> Optional[KeltnerBand{upperBand=1.543333, midBand=1.423333, lowerBand=1.303333}]
```