// Path: src/main/java/au/net/woodberry/ta/toolbox/enums/Zone.java
// public enum Zone {
//     
//     SELL(true),
//     BUY_HOLD(false),
//     PROFIT_TAKE_HOLD(false),
//     PROFIT_TAKE(true);
//     
//     private final boolean mandatory;
// 
//     Zone(boolean mandatory) {
//         this.mandatory = mandatory;
//     }
// 
//     public boolean isMandatory() {
//         return mandatory;
//     }
// }
// 
// Path: src/main/java/au/net/woodberry/ta/toolbox/indicators/trackers/HMAIndicator.java
// public class HMAIndicator extends CachedIndicator<TADecimal> {
// 
//     private final WMAIndicator wma1;
//     private final WMAIndicator wma2;
// 
//     /**
//      * The Hull Moving Average 
//      * (Author: Alan Hull)
//      *  
//      * Formula: 
//      * ﻿Hull = WMA( 2*WMA(C,int(Period/2))- WMA(C,Period),int(sqrt(Period)));
//      *  
//      * Reference
//      * http://www.traderslog.com/hullmovingaverage/
//      */
//     public HMAIndicator(TimeSeries timeSeries, int timeFrame) {
//         if (timeSeries == null) {
//             throw new IllegalArgumentException("Supplied TimeSeries is invalid: NULL");
//         }
//         if (timeFrame < 2) { // Require at least 2 periods, otherwise WMA becomes unhappy.
//             throw new IllegalArgumentException("Supplied timeFrame is invalid: Must not be less than 2");
//         }
//         this.wma1 = new WMAIndicator(new ClosePriceIndicator(timeSeries), timeFrame);
//         this.wma2 = new WMAIndicator(new ClosePriceIndicator(timeSeries), timeFrame/2);
//     }
// 
//     @Override
//     protected TADecimal calculate(int index) {
//         ConstantIndicator<TADecimal> constantIndicator = new ConstantIndicator<>(TADecimal.TWO.multipliedBy(wma2.getValue(index)).minus(wma1.getValue(index)));
//         WMAIndicator wmaIndicator = new WMAIndicator(constantIndicator, Double.valueOf(Math.sqrt(index)).intValue());
//         return wmaIndicator.getValue(index);
//     }
// }
// 
// Path: src/main/java/au/net/woodberry/ta/toolbox/object/Range.java
// public class Range {
// 
//     private final TADecimal upperDeviation;
//     private final TADecimal centralCord;
//     private final TADecimal lowerDeviation;
//     private final Zone zone;
// 
//     public Range(TADecimal upperDeviation, TADecimal centralCord, TADecimal lowerDeviation, Zone zone) {
//         this.upperDeviation = upperDeviation;
//         this.centralCord = centralCord;
//         this.lowerDeviation = lowerDeviation;
//         this.zone = zone;
//     }
// 
//     public TADecimal getUpperDeviation() {
//         return upperDeviation;
//     }
// 
//     public TADecimal getCentralCord() {
//         return centralCord;
//     }
// 
//     public TADecimal getLowerDeviation() {
//         return lowerDeviation;
//     }
// 
//     public Zone getZone() {
//         return zone;
//     }
// }


import au.net.woodberry.ta.toolbox.enums.Zone;
import au.net.woodberry.ta.toolbox.indicators.trackers.HMAIndicator;
import au.net.woodberry.ta.toolbox.object.Range;
import eu.verdelhan.ta4j.TADecimal;
import eu.verdelhan.ta4j.TimeSeries;
import eu.verdelhan.ta4j.indicators.CachedIndicator;
package au.net.woodberry.ta.toolbox.indicators.volatility;


public class RangeIndicator extends CachedIndicator<Range> {
    
    public static final double DEFAULT_DISPLACEMENT_LOWER = 2.5;
    public static final double DEFAULT_DISPLACEMENT_UPPER = 3.0;
    public static final int DEFAULT_TIME_FRAME = 13;
    
    private final TimeSeries timeSeries;
// Path: src/main/java/au/net/woodberry/ta/toolbox/enums/Zone.java
// public enum Zone {
//     
//     SELL(true),
//     BUY_HOLD(false),
//     PROFIT_TAKE_HOLD(false),
//     PROFIT_TAKE(true);
//     
//     private final boolean mandatory;
// 
//     Zone(boolean mandatory) {
//         this.mandatory = mandatory;
//     }
// 
//     public boolean isMandatory() {
//         return mandatory;
//     }
// }
// 
// Path: src/main/java/au/net/woodberry/ta/toolbox/indicators/trackers/HMAIndicator.java
// public class HMAIndicator extends CachedIndicator<TADecimal> {
// 
//     private final WMAIndicator wma1;
//     private final WMAIndicator wma2;
// 
//     /**
//      * The Hull Moving Average 
//      * (Author: Alan Hull)
//      *  
//      * Formula: 
//      * ﻿Hull = WMA( 2*WMA(C,int(Period/2))- WMA(C,Period),int(sqrt(Period)));
//      *  
//      * Reference
//      * http://www.traderslog.com/hullmovingaverage/
//      */
//     public HMAIndicator(TimeSeries timeSeries, int timeFrame) {
//         if (timeSeries == null) {
//             throw new IllegalArgumentException("Supplied TimeSeries is invalid: NULL");
//         }
//         if (timeFrame < 2) { // Require at least 2 periods, otherwise WMA becomes unhappy.
//             throw new IllegalArgumentException("Supplied timeFrame is invalid: Must not be less than 2");
//         }
//         this.wma1 = new WMAIndicator(new ClosePriceIndicator(timeSeries), timeFrame);
//         this.wma2 = new WMAIndicator(new ClosePriceIndicator(timeSeries), timeFrame/2);
//     }
// 
//     @Override
//     protected TADecimal calculate(int index) {
//         ConstantIndicator<TADecimal> constantIndicator = new ConstantIndicator<>(TADecimal.TWO.multipliedBy(wma2.getValue(index)).minus(wma1.getValue(index)));
//         WMAIndicator wmaIndicator = new WMAIndicator(constantIndicator, Double.valueOf(Math.sqrt(index)).intValue());
//         return wmaIndicator.getValue(index);
//     }
// }
// 
// Path: src/main/java/au/net/woodberry/ta/toolbox/object/Range.java
// public class Range {
// 
//     private final TADecimal upperDeviation;
//     private final TADecimal centralCord;
//     private final TADecimal lowerDeviation;
//     private final Zone zone;
// 
//     public Range(TADecimal upperDeviation, TADecimal centralCord, TADecimal lowerDeviation, Zone zone) {
//         this.upperDeviation = upperDeviation;
//         this.centralCord = centralCord;
//         this.lowerDeviation = lowerDeviation;
//         this.zone = zone;
//     }
// 
//     public TADecimal getUpperDeviation() {
//         return upperDeviation;
//     }
// 
//     public TADecimal getCentralCord() {
//         return centralCord;
//     }
// 
//     public TADecimal getLowerDeviation() {
//         return lowerDeviation;
//     }
// 
//     public Zone getZone() {
//         return zone;
//     }
// }


// Path: src/main/java/au/net/woodberry/ta/toolbox/indicators/volatility/RangeIndicator.java
import au.net.woodberry.ta.toolbox.enums.Zone;
import au.net.woodberry.ta.toolbox.indicators.trackers.HMAIndicator;
import au.net.woodberry.ta.toolbox.object.Range;
import eu.verdelhan.ta4j.TADecimal;
import eu.verdelhan.ta4j.TimeSeries;
import eu.verdelhan.ta4j.indicators.CachedIndicator;

package au.net.woodberry.ta.toolbox.indicators.volatility;


public class RangeIndicator extends CachedIndicator<Range> {
    
    public static final double DEFAULT_DISPLACEMENT_LOWER = 2.5;
    public static final double DEFAULT_DISPLACEMENT_UPPER = 3.0;
    public static final int DEFAULT_TIME_FRAME = 13;
    
    private final TimeSeries timeSeries;
    private final HMAIndicator hmaIndicator;