I've piece of code, that isn't working(expert advisor hangs) when period = Period.Monthly:
Calendar from = Calendar.getInstance();
from.setTimeZone(TimeZone.getTimeZone("GMT"));
from.setTimeInMillis (time);
if ( period == Period.DAILY )
from.roll(Calendar.DAY_OF_YEAR, -1);
else if ( period == Period.WEEKLY )
from.roll(Calendar.DAY_OF_YEAR, -7);
else if ( period == Period.MONTHLY )
from.roll(Calendar.DAY_OF_YEAR, -30);
Calendar to = Calendar.getInstance();
to.setTimeZone(TimeZone.getTimeZone("GMT"));
to.setTimeInMillis (time);
java.util.List<IOrder> orders = this.context.getHistory().getOrdersHistory(this.instrument, from.getTimeInMillis(), to.getTimeInMillis());
When I'm using the:
else if ( period == Period.MONTHLY )
from.roll(Calendar.DAY_OF_YEAR, -15);
The expert adsvisor is works, but I'm really need the orders history for the last month(not half month).
Please consider this report and help me to solve the problem.