當前位置: 首頁>>代碼示例>>Java>>正文


Java Tick.getClosePrice方法代碼示例

本文整理匯總了Java中org.ta4j.core.Tick.getClosePrice方法的典型用法代碼示例。如果您正苦於以下問題:Java Tick.getClosePrice方法的具體用法?Java Tick.getClosePrice怎麽用?Java Tick.getClosePrice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.ta4j.core.Tick的用法示例。


在下文中一共展示了Tick.getClosePrice方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Boolean calculate(int index) {
    if (index < 1) {
        // Harami is a 2-candle pattern
        return false;
    }
    Tick prevTick = series.getTick(index-1);
    Tick currTick = series.getTick(index);
    if (prevTick.isBearish() && currTick.isBullish()) {
        final Decimal prevOpenPrice = prevTick.getOpenPrice();
        final Decimal prevClosePrice = prevTick.getClosePrice();
        final Decimal currOpenPrice = currTick.getOpenPrice();
        final Decimal currClosePrice = currTick.getClosePrice();
        return currOpenPrice.isLessThan(prevOpenPrice) && currOpenPrice.isGreaterThan(prevClosePrice)
                && currClosePrice.isLessThan(prevOpenPrice) && currClosePrice.isGreaterThan(prevClosePrice);
    }
    return false;
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:19,代碼來源:BullishHaramiIndicator.java

示例2: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Boolean calculate(int index) {
    if (index < 1) {
        // Harami is a 2-candle pattern
        return false;
    }
    Tick prevTick = series.getTick(index-1);
    Tick currTick = series.getTick(index);
    if (prevTick.isBullish() && currTick.isBearish()) {
        final Decimal prevOpenPrice = prevTick.getOpenPrice();
        final Decimal prevClosePrice = prevTick.getClosePrice();
        final Decimal currOpenPrice = currTick.getOpenPrice();
        final Decimal currClosePrice = currTick.getClosePrice();
        return currOpenPrice.isGreaterThan(prevOpenPrice) && currOpenPrice.isLessThan(prevClosePrice)
                && currClosePrice.isGreaterThan(prevOpenPrice) && currClosePrice.isLessThan(prevClosePrice);
    }
    return false;
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:19,代碼來源:BearishHaramiIndicator.java

示例3: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Boolean calculate(int index) {
    if (index < 1) {
        // Engulfing is a 2-candle pattern
        return false;
    }
    Tick prevTick = series.getTick(index-1);
    Tick currTick = series.getTick(index);
    if (prevTick.isBullish() && currTick.isBearish()) {
        final Decimal prevOpenPrice = prevTick.getOpenPrice();
        final Decimal prevClosePrice = prevTick.getClosePrice();
        final Decimal currOpenPrice = currTick.getOpenPrice();
        final Decimal currClosePrice = currTick.getClosePrice();
        return currOpenPrice.isGreaterThan(prevOpenPrice) && currOpenPrice.isGreaterThan(prevClosePrice)
                && currClosePrice.isLessThan(prevOpenPrice) && currClosePrice.isLessThan(prevClosePrice);
    }
    return false;
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:19,代碼來源:BearishEngulfingIndicator.java

示例4: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Boolean calculate(int index) {
    if (index < 1) {
        // Engulfing is a 2-candle pattern
        return false;
    }
    Tick prevTick = series.getTick(index-1);
    Tick currTick = series.getTick(index);
    if (prevTick.isBearish() && currTick.isBullish()) {
        final Decimal prevOpenPrice = prevTick.getOpenPrice();
        final Decimal prevClosePrice = prevTick.getClosePrice();
        final Decimal currOpenPrice = currTick.getOpenPrice();
        final Decimal currClosePrice = currTick.getClosePrice();
        return currOpenPrice.isLessThan(prevOpenPrice) && currOpenPrice.isLessThan(prevClosePrice)
                && currClosePrice.isGreaterThan(prevOpenPrice) && currClosePrice.isGreaterThan(prevClosePrice);
    }
    return false;
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:19,代碼來源:BullishEngulfingIndicator.java

示例5: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Decimal calculate(int index) {
    if (index == 0) {
        return Decimal.THOUSAND;
    }
    
    Tick currentTick = series.getTick(index);
    Tick previousTick = series.getTick(index - 1);
    Decimal previousValue = getValue(index - 1);
    
    if (currentTick.getVolume().isLessThan(previousTick.getVolume())) {
        Decimal currentPrice = currentTick.getClosePrice();
        Decimal previousPrice = previousTick.getClosePrice();
        Decimal priceChangeRatio = currentPrice.minus(previousPrice).dividedBy(previousPrice);
        return previousValue.plus(priceChangeRatio.multipliedBy(previousValue));
    }
    return previousValue;
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:19,代碼來源:NVIIndicator.java

示例6: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Decimal calculate(int index) {
    if (index == 0) {
        return Decimal.THOUSAND;
    }
    
    Tick currentTick = series.getTick(index);
    Tick previousTick = series.getTick(index - 1);
    Decimal previousValue = getValue(index - 1);
    
    if (currentTick.getVolume().isGreaterThan(previousTick.getVolume())) {
        Decimal currentPrice = currentTick.getClosePrice();
        Decimal previousPrice = previousTick.getClosePrice();
        Decimal priceChangeRatio = currentPrice.minus(previousPrice).dividedBy(previousPrice);
        return previousValue.plus(priceChangeRatio.multipliedBy(previousValue));
    }
    return previousValue;
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:19,代碼來源:PVIIndicator.java

示例7: isDeclining

import org.ta4j.core.Tick; //導入方法依賴的package包/類
/**
 * @param index the current tick/candle index
 * @return true if the current tick/candle is declining, false otherwise
 */
private boolean isDeclining(int index) {
    Tick prevTick = series.getTick(index-1);
    Tick currTick = series.getTick(index);
    final Decimal prevOpenPrice = prevTick.getOpenPrice();
    final Decimal prevClosePrice = prevTick.getClosePrice();
    final Decimal currOpenPrice = currTick.getOpenPrice();
    final Decimal currClosePrice = currTick.getClosePrice();
    
    // Opens within the body of the previous candle
    return currOpenPrice.isLessThan(prevOpenPrice) && currOpenPrice.isGreaterThan(prevClosePrice)
            // Closes below the previous close price
            && currClosePrice.isLessThan(prevClosePrice);
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:18,代碼來源:ThreeBlackCrowsIndicator.java

示例8: isGrowing

import org.ta4j.core.Tick; //導入方法依賴的package包/類
/**
 * @param index the current tick/candle index
 * @return true if the current tick/candle is growing, false otherwise
 */
private boolean isGrowing(int index) {
    Tick prevTick = series.getTick(index-1);
    Tick currTick = series.getTick(index);
    final Decimal prevOpenPrice = prevTick.getOpenPrice();
    final Decimal prevClosePrice = prevTick.getClosePrice();
    final Decimal currOpenPrice = currTick.getOpenPrice();
    final Decimal currClosePrice = currTick.getClosePrice();
    
    // Opens within the body of the previous candle
    return currOpenPrice.isGreaterThan(prevOpenPrice) && currOpenPrice.isLessThan(prevClosePrice)
            // Closes above the previous close price
            && currClosePrice.isGreaterThan(prevClosePrice);
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:18,代碼來源:ThreeWhiteSoldiersIndicator.java

示例9: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Decimal calculate(int index) {
    Tick t = series.getTick(index);
    final Decimal openPrice = t.getOpenPrice();
    final Decimal closePrice = t.getClosePrice();
    if (closePrice.isGreaterThan(openPrice)) {
        // Bullish
        return openPrice.minus(t.getMinPrice());
    } else {
        // Bearish
        return closePrice.minus(t.getMinPrice());
    }
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:14,代碼來源:LowerShadowIndicator.java

示例10: calculate

import org.ta4j.core.Tick; //導入方法依賴的package包/類
@Override
protected Decimal calculate(int index) {
    Tick t = series.getTick(index);
    final Decimal openPrice = t.getOpenPrice();
    final Decimal closePrice = t.getClosePrice();
    if (closePrice.isGreaterThan(openPrice)) {
        // Bullish
        return t.getMaxPrice().minus(closePrice);
    } else {
        // Bearish
        return t.getMaxPrice().minus(openPrice);
    }
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:14,代碼來源:UpperShadowIndicator.java

示例11: calcPivotPoint

import org.ta4j.core.Tick; //導入方法依賴的package包/類
private Decimal calcPivotPoint(List<Integer> ticksOfPreviousPeriod) {
       if (ticksOfPreviousPeriod.isEmpty())
           return Decimal.NaN;
       Tick tick = getTimeSeries().getTick(ticksOfPreviousPeriod.get(0));
	Decimal close = tick.getClosePrice();
	Decimal high =  tick.getMaxPrice();
	Decimal low = tick.getMinPrice();
	for(int i: ticksOfPreviousPeriod){
		high = (getTimeSeries().getTick(i).getMaxPrice()).max(high);
		low = (getTimeSeries().getTick(i).getMinPrice()).min(low);
	}
	return (high.plus(low).plus(close)).dividedBy(Decimal.THREE);
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:14,代碼來源:PivotPointIndicator.java

示例12: calcPivotPoint

import org.ta4j.core.Tick; //導入方法依賴的package包/類
private Decimal calcPivotPoint(List<Integer> ticksOfPreviousPeriod) {
       if (ticksOfPreviousPeriod.isEmpty())
           return Decimal.NaN;
       Tick tick = getTimeSeries().getTick(ticksOfPreviousPeriod.get(0));
	Decimal open = getTimeSeries().getTick(ticksOfPreviousPeriod.get(ticksOfPreviousPeriod.size()-1)).getOpenPrice();
       Decimal close = tick.getClosePrice();
	Decimal high =  tick.getMaxPrice();
	Decimal low = tick.getMinPrice();

       for(int i: ticksOfPreviousPeriod){
           high = (getTimeSeries().getTick(i).getMaxPrice()).max(high);
           low = (getTimeSeries().getTick(i).getMinPrice()).min(low);
       }

	Decimal x;

	if (close.isLessThan(open)){
	    x = high.plus(Decimal.TWO.multipliedBy(low)).plus(close);
       }
       else if (close.isGreaterThan(open)) {
           x = Decimal.TWO.multipliedBy(high).plus(low).plus(close);
       }
       else{
	    x = high.plus(low).plus(Decimal.TWO.multipliedBy(close));
       }

	return x.dividedBy(Decimal.valueOf(4));
}
 
開發者ID:ta4j,項目名稱:ta4j,代碼行數:29,代碼來源:DeMarkPivotPointIndicator.java


注:本文中的org.ta4j.core.Tick.getClosePrice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。