yoursong wrote:
e.g. i fed eurusd, gbpusd, usdjpy in on M1 eurusd chart. Sometimes all 3 get 4000 bars, a lot of times though only eurusd (chart instrument) gets 4000 bars and the others only 2000-3000 which means some bars a bit back are not available for calculation.
How do i handle such situations?
I'm in this situation, use something like this
int minInputLen = input[0].length; // Instr1 on Chart
minInputLen = Math.min(inputs[1][0].length, minInputLen); // Instr2
minInputLen = Math.min(inputs[2][0].length, minInputLen); // Instr3
int delta = input[0].length - minInputLen;
if ((delta>0) && (delta + getLookback() < startIndex)) {
return new IndicatorResult(0, 0);
}
int delta1 = input[0].length - inputs[1][0].length;
int delta2 = input[0].length - inputs[2][0].length;
for (int i = (delta>=0 ? delta : 0); i < input[0].length; i++) {
double p1 = inputs[1][0][i - delta1];
double p2 = inputs[2][0][i - delta2];
}