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


Java Decimal.THREE属性代码示例

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


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

示例1: setUp

@Before
public void setUp() {
    constantIndicator = new ConstantIndicator<Decimal>(Decimal.valueOf(6));
    mockIndicator = new FixedIndicator<Decimal>(
            Decimal.valueOf("-2.0"),
            Decimal.valueOf("0.00"),
            Decimal.valueOf("1.00"),
            Decimal.valueOf("2.53"),
            Decimal.valueOf("5.87"),
            Decimal.valueOf("6.00"),
            Decimal.valueOf("10.0")
    );
    mockIndicator2 = new FixedIndicator<Decimal>(
            Decimal.ZERO,
            Decimal.ONE,
            Decimal.TWO,
            Decimal.THREE,
            Decimal.TEN,
            Decimal.valueOf("-42"),
            Decimal.valueOf("-1337")
    );
    sumIndicator = new SumIndicator(constantIndicator, mockIndicator, mockIndicator2);
}
 
开发者ID:mdeverdelhan,项目名称:ta4j-origins,代码行数:23,代码来源:SumIndicatorTest.java

示例2: strategyExecutionOnCachedIndicatorAndLimitedTimeSeries

@Test
public void strategyExecutionOnCachedIndicatorAndLimitedTimeSeries() {
    TimeSeries timeSeries = new MockTimeSeries(0, 1, 2, 3, 4, 5, 6, 7);
    SMAIndicator sma = new SMAIndicator(new ClosePriceIndicator(timeSeries), 2);
    // Theoretical values for SMA(2) cache: 0, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5
    timeSeries.setMaximumTickCount(6);
    // Theoretical values for SMA(2) cache: null, null, 2, 2.5, 3.5, 4.5, 5.5, 6.5
    
    Strategy strategy = new BaseStrategy(
            new OverIndicatorRule(sma, Decimal.THREE),
            new UnderIndicatorRule(sma, Decimal.THREE)
    );
    // Theoretical shouldEnter results: false, false, false, false, true, true, true, true
    // Theoretical shouldExit results: false, false, true, true, false, false, false, false

    // As we return the first tick/result found for the removed ticks:
    // -> Approximated values for ClosePrice cache: 2, 2, 2, 3, 4, 5, 6, 7
    // -> Approximated values for SMA(2) cache: 2, 2, 2, 2.5, 3.5, 4.5, 5.5, 6.5

    // Then enters/exits are also approximated:
    // -> shouldEnter results: false, false, false, false, true, true, true, true
    // -> shouldExit results: true, true, true, true, false, false, false, false

    assertFalse(strategy.shouldEnter(0));
    assertTrue(strategy.shouldExit(0));
    assertFalse(strategy.shouldEnter(1));
    assertTrue(strategy.shouldExit(1));
    assertFalse(strategy.shouldEnter(2));
    assertTrue(strategy.shouldExit(2));
    assertFalse(strategy.shouldEnter(3));
    assertTrue(strategy.shouldExit(3));
    assertTrue(strategy.shouldEnter(4));
    assertFalse(strategy.shouldExit(4));
    assertTrue(strategy.shouldEnter(5));
    assertFalse(strategy.shouldExit(5));
    assertTrue(strategy.shouldEnter(6));
    assertFalse(strategy.shouldExit(6));
    assertTrue(strategy.shouldEnter(7));
    assertFalse(strategy.shouldExit(7));
}
 
开发者ID:mdeverdelhan,项目名称:ta4j-origins,代码行数:40,代码来源:CachedIndicatorTest.java

示例3: ChandelierExitShortIndicator

/**
 * Constructor.
 * @param series the time series
 */
public ChandelierExitShortIndicator(TimeSeries series) {
    this(series, 22, Decimal.THREE);
}
 
开发者ID:mdeverdelhan,项目名称:ta4j-origins,代码行数:7,代码来源:ChandelierExitShortIndicator.java

示例4: ChandelierExitLongIndicator

/**
 * Constructor.
 * @param series the time series
 */
public ChandelierExitLongIndicator(TimeSeries series) {
    this(series, 22, Decimal.THREE);
}
 
开发者ID:mdeverdelhan,项目名称:ta4j-origins,代码行数:7,代码来源:ChandelierExitLongIndicator.java


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