本文整理汇总了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);
}
示例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));
}
示例3: ChandelierExitShortIndicator
/**
* Constructor.
* @param series the time series
*/
public ChandelierExitShortIndicator(TimeSeries series) {
this(series, 22, Decimal.THREE);
}
示例4: ChandelierExitLongIndicator
/**
* Constructor.
* @param series the time series
*/
public ChandelierExitLongIndicator(TimeSeries series) {
this(series, 22, Decimal.THREE);
}