hi - why can't I use DayOfWeek in a demo account Strategy remote run?
I get this error when I try & start it:
2012-12-11 03:08:17 Unable to run strategy remotely : Parameter type is not supported : jforex.strategies.indicators.fxp205$DayOfWeek; Parameter type is not supported : jforex.strategies.indicators.fxp205$DayOfWeek
It is fine on Local run & on Historical tester.
(other strategies without $DayOfWeek are fine on Remote run.)
I don't think I'm attempting anything unusual - here is example of how I'm using it:
@Configurable("Start Week") public DayOfWeek openDayOfWeek = DayOfWeek.MONDAY;
@Configurable("Open hour") public int openHour = 7;
@Configurable("Open min") public int openMin = 0;
@Configurable("Close hour") public int closeHour = 19;
@Configurable("Close min") public int closeMin = 0;
@Configurable("End Week") public DayOfWeek closeDayOfWeek = DayOfWeek.FRIDAY; enum DayOfWeek {
SUNDAY(1),
MONDAY(2),
TUESDAY(3),
WEDNESDAY(4),
THURSDAY(5),
FRIDAY(6),
SATURDAY(7);
private int idx;
private DayOfWeek(int idx) {
this.idx = idx;
}
public int getIdx() {
return idx;
}
}if (!isInInterval(tick.getTime(), openDayOfWeek.getIdx(), openHour, openMin, closeDayOfWeek.getIdx(), closeHour, closeMin)) {
closeOrder(shortOrder);
closeOrder(longOrder);
return;
} public boolean isInInterval(long time, int fromDayOfWeek, int fromHour, int fromMin, int toDayOfWeek, int toHour, int toMin){
Calendar calFrom = new GregorianCalendar();
calFrom.setTimeZone(TimeZone.getTimeZone("GMT"));
calFrom.setTimeInMillis(time);
calFrom.set(Calendar.HOUR_OF_DAY, fromHour);
calFrom.set(Calendar.MINUTE, fromMin);
Calendar calTo = new GregorianCalendar();
calTo.setTimeZone(TimeZone.getTimeZone("GMT"));
calTo.setTimeInMillis(time);
calTo.set(Calendar.HOUR_OF_DAY, toHour);
calTo.set(Calendar.MINUTE, toMin);
if (Every_Day) {
if (time >= calFrom.getTimeInMillis() && // test time regardless of day
time <= calTo.getTimeInMillis())
return true;
else return false;
}
Calendar calNow = new GregorianCalendar();
calNow.setTimeZone(TimeZone.getTimeZone("GMT"));
calNow.setTimeInMillis(time);
if ((calNow.get(Calendar.DAY_OF_WEEK) > fromDayOfWeek && // Tues - Thurs all ok
(calNow.get(Calendar.DAY_OF_WEEK) < toDayOfWeek)))
return true;
if ((calNow.get(Calendar.DAY_OF_WEEK) == fromDayOfWeek && time >= calFrom.getTimeInMillis()) || // Mon
(calNow.get(Calendar.DAY_OF_WEEK) == toDayOfWeek && time <= calTo.getTimeInMillis())) // Fri
return true;
return false;
}