📄 periodlow.java
字号:
package com.jsystemtrader.indicator;
import com.jsystemtrader.platform.*;
/**
* Lowest low of the period.
*/
public class PeriodLow extends Indicator {
private final int periodStart, periodEnd;
public PeriodLow(long time, QuoteHistory qh, int periodStart, int periodEnd) {
super(time, qh);
this.periodStart = periodStart;
this.periodEnd = periodEnd;
}
public double calculate() throws IndicatorCalculationException {
if (periodStart < 0) {
throw new IndicatorCalculationException("Period start must be greater or equal to 0.");
}
if (periodEnd > qh.size() - 1) {
throw new IndicatorCalculationException("Period end exceeds the length of quote history.");
}
double low = qh.getPriceBar(periodStart).getLow();
for (int bar = periodStart + 1; bar <= periodEnd; bar++) {
double barLow = qh.getPriceBar(bar).getLow();
if (barLow < low) {
low = barLow;
}
}
value = low;
return value;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -