当前位置: 首页>>代码示例>>Java>>正文


Java Indicator.getTimeSeries方法代码示例

本文整理汇总了Java中org.ta4j.core.Indicator.getTimeSeries方法的典型用法代码示例。如果您正苦于以下问题:Java Indicator.getTimeSeries方法的具体用法?Java Indicator.getTimeSeries怎么用?Java Indicator.getTimeSeries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ta4j.core.Indicator的用法示例。


在下文中一共展示了Indicator.getTimeSeries方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FisherIndicator

import org.ta4j.core.Indicator; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param price the price indicator (usually {@link MedianPriceIndicator})
 * @param timeFrame the time frame (usually 10)
 * @param alpha the alpha (usually 0.33)
 * @param beta the beta (usually 0.67)
 */
public FisherIndicator(Indicator<Decimal> price, int timeFrame, final Decimal alpha, final Decimal beta) {
    super(price);
    this.price = price;
    final Indicator<Decimal> periodHigh = new HighestValueIndicator(new MaxPriceIndicator(price.getTimeSeries()), timeFrame);
    final Indicator<Decimal> periodLow = new LowestValueIndicator(new MinPriceIndicator(price.getTimeSeries()), timeFrame);
    intermediateValue = new RecursiveCachedIndicator<Decimal>(price) {

        @Override
        protected Decimal calculate(int index) {
            if (index <= 0) {
                return Decimal.ZERO;
            }
            // alpha * 2 * ((price - MinL) / (MaxH - MinL) - 0.5) + beta * prior value
            Decimal currentPrice = FisherIndicator.this.price.getValue(index);
            Decimal minL = periodLow.getValue(index);
            Decimal maxH = periodHigh.getValue(index);
            Decimal firstPart = currentPrice.minus(minL).dividedBy(maxH.min(minL)).minus(ZERO_DOT_FIVE);
            Decimal secondPart = alpha.multipliedBy(Decimal.TWO).multipliedBy(firstPart);
            Decimal value = secondPart.plus(beta.multipliedBy(getValue(index - 1)));
            if (value.isGreaterThan(VALUE_MAX)) {
                value = VALUE_MAX;
            } else if (value.isLessThan(VALUE_MIN)) {
                value = VALUE_MIN;
            }
            return value;
        }
    };
}
 
开发者ID:ta4j,项目名称:ta4j,代码行数:37,代码来源:FisherIndicator.java

示例2: DonchianChannelUpper

import org.ta4j.core.Indicator; //导入方法依赖的package包/类
public DonchianChannelUpper(Indicator<Decimal> indicator, int timeFrame) {
      super(indicator.getTimeSeries());
this.indicator = indicator;
this.timeFrame = timeFrame;
  }
 
开发者ID:jnidzwetzki,项目名称:crypto-bot,代码行数:6,代码来源:DonchianChannelUpper.java

示例3: DonchianChannelLower

import org.ta4j.core.Indicator; //导入方法依赖的package包/类
public DonchianChannelLower(Indicator<Decimal> indicator, int timeFrame) {
      super(indicator.getTimeSeries());
this.indicator = indicator;
this.timeFrame = timeFrame;
  }
 
开发者ID:jnidzwetzki,项目名称:crypto-bot,代码行数:6,代码来源:DonchianChannelLower.java

示例4: CachedIndicator

import org.ta4j.core.Indicator; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param indicator a related indicator (with a time series)
 */
public CachedIndicator(Indicator indicator) {
    this(indicator.getTimeSeries());
}
 
开发者ID:ta4j,项目名称:ta4j,代码行数:8,代码来源:CachedIndicator.java

示例5: RecursiveCachedIndicator

import org.ta4j.core.Indicator; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param indicator a related indicator (with a time series)
 */
public RecursiveCachedIndicator(Indicator indicator) {
    this(indicator.getTimeSeries());
}
 
开发者ID:ta4j,项目名称:ta4j,代码行数:8,代码来源:RecursiveCachedIndicator.java


注:本文中的org.ta4j.core.Indicator.getTimeSeries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。