Hello!
I am not quite sure whether the mistake is on my side but the value from the chart is different from that one I gain from the onStop method. I call a method with this:
(contained by onStop)
... long creationTime = o.getCreationTime(); ... if (o.isLong()) console.getOut().print((getT3Long(creationTime)[2] - getT3Long(history.getPreviousBarStart(t3AuxiliaryPeriod2, creationTime))[2]) + ";"); ...
My method:
public double[] getT3Long(long time) { double[] t3 = {-1}; double[] t3a = {-1}; double[] t3a2 = {-1}; double[] result = {-1, -1, -1};
try { long barTime = history.getBarStart(t3Period, time); t3 = indicators.t3(currency, t3Period, OfferSide.ASK, t3AppliedPrice, t3TimePeriod, t3vFactor, barTime, barTime);
//Auxiliary period long barTimeA = history.getBarStart(t3AuxiliaryPeriod, time); t3a = indicators.t3(currency, t3AuxiliaryPeriod, OfferSide.ASK, t3AppliedPrice, t3TimePeriod, t3vFactor, barTimeA, barTimeA);
//Auxiliary period 2 long barTimeA2 = history.getBarStart(t3AuxiliaryPeriod2, time); t3a2 = indicators.t3(currency, t3AuxiliaryPeriod2, OfferSide.ASK, t3AppliedPrice, t3TimePeriod, t3vFactor, barTimeA2, barTimeA2);
result[0] = t3[0]; result[1] = t3a[0]; result[2] = t3a2[0]; } catch (Exception e) { console.getErr().println("T3 long: " + e.getMessage()); }
return result; } //End of method getT3Long
I use the indicator and the chart correctly but there are different values displayed.
Is it a bug within the backtest function or is my source code wrong?
Thanks and regards!
|