This is a code sample to measure execution time of code fragment:
long start = System.currentTimeMillis();
// do the work
long end = System.currentTimeMillis();
console.getOut().println("execution time:"+ (end - start));
In general, operations with history and indicators tend to require more time than the others. Therefore, they could be optimized first.
Also, for performance it is better to do heavy work in onBar() method rather than onTick().