本文整理汇总了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;
}
};
}
示例2: DonchianChannelUpper
import org.ta4j.core.Indicator; //导入方法依赖的package包/类
public DonchianChannelUpper(Indicator<Decimal> indicator, int timeFrame) {
super(indicator.getTimeSeries());
this.indicator = indicator;
this.timeFrame = timeFrame;
}
示例3: DonchianChannelLower
import org.ta4j.core.Indicator; //导入方法依赖的package包/类
public DonchianChannelLower(Indicator<Decimal> indicator, int timeFrame) {
super(indicator.getTimeSeries());
this.indicator = indicator;
this.timeFrame = timeFrame;
}
示例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());
}
示例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());
}