请问有没有对JForex的API有经验的达人给小弟解一下惑?
最近在尝试编写JForex的自动交易策略,发现一个问题:通过代码和API得出的SMA和ATR的值和图表上显示的不一样。实验了多次都是如此,不知是我哪里弄错了。望有达人指点一二,多谢。如图中,图表中的ATR200值是0.00165,而代码输出的ATR200值则是0.00138.
附上代码和图表屏幕截图:
...
private Instrument instrument = Instrument.EURUSD;
private Period timeFrame = Period.THIRTY_MINS;
private int timePeriod = 200;
private double Bid, Ask;
...
public void onTick(Instrument instrument, ITick tick) throws JFException {
Bid = tick.getBid(); Ask = tick.getAsk();
double SMA = indicators.sma(this.instrument, timeFrame, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, timePeriod, 0);
double ATR = indicators.atr(this.instrument, timeFrame, OfferSide.BID, timePeriod, 0);
console.getOut().println("Instrument= "+this.instrument+", Time Frame= "+timeFrame+", Bid= "+Bid+", Ask= "+Ask);
console.getOut().println("SMA"+timePeriod+"= "+SMA+", ATR"+timePeriod+"= "+ATR);
} 解惑了吗????????? 解了,自己解了:victory: cold-river 发表于 2012-12-29 17:57
解了,自己解了
请问是怎么解决的???我也出现这个问题!我计算的是SMA,API计算结果与图标上不一样,郁闷!试了很久了都不行,求解答!
页:
[1]