shewenhao wrote:
may you tell me where I could find the defination of the all default indicators??
Indicator source codes are published in
Standalone JForex-API. Find there also TVS indicator. Part of indicators are described in JForex wiki
Indicator catalog, usage of indicators from strategies can be found
here.
shewenhao wrote:
I just want to know the EXACT defination of this indicator for understanding and rewritting based on the code from Dukascopy as well.
Regarding the TVS algorithm, see comments we added to the
calculate method of the indicator:
public IndicatorResult calculate(int startIndex, int endIndex) {
//calculating startIndex taking into account lookback value
if (startIndex - getLookback() < 0) {
startIndex -= startIndex - getLookback();
}
if (startIndex > endIndex) {
return new IndicatorResult(0, 0);
}
//multPrice
int resIndex = 0;
for (int z = startIndex; z <= endIndex; z++, resIndex++) {
double sum = 0;
//accumulate values over the lookback (i.e. Time Period) period
for (int i = resIndex; i < (resIndex + getLookback()); i++) {
double tmp = 0;
if (i != resIndex) {
//Inputs: 0 open, 1 close, 2 high, 3 low, 4 volume
//green bar - close price higher than previous one
if (inputs[0][1][i] > inputs[0][1][i - 1]) {
//volume * green bar height
tmp = inputs[0][4][i] * (inputs[0][1][i] - inputs[0][1][i - 1]);
//red bar - close price lower than previous one
} else if (inputs[0][1][i] < inputs[0][1][i - 1]) {
//volume * red bar height
tmp = (-1) * inputs[0][4][i] * (-inputs[0][1][i] + inputs[0][1][i - 1]);
//flat bar - close prices are equal
} else {
tmp = 0;
}
}
//accumulate
sum = sum + tmp;
}
//assign output
outputs[0][resIndex] = sum;
}
return new IndicatorResult(startIndex, resIndex);
}
Thus the result of indicator value is an accumulated multiplications of volumes and bar sizes over the given time period.
For more on indicators see JForex wiki:
https://www.dukascopy.com/wiki/#Indicator_API:_Overview