SquareRoot wrote:
What exactly is a flat candle? Is it the last returned price continuously repeated or is it a null price?
What is the best way to avoid this problem? A code example would help.
If a candle close and the candle open price equals and the candle open price equals with a previous candle close price, then this is a flat candle. You can call an indicator with a Filter parameter or you can skip holidays in your strategy. Please consider the following code:
private boolean isTradableDay(long tickTime){
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(tickTime);
int weekday = calendar.get(Calendar.DAY_OF_WEEK);
if (weekday == Calendar.SATURDAY) {
return false;
} else if (weekday == Calendar.SUNDAY) {
return false;
}
return true;
}