In the meantime, I'm posting a few snippets that I coded (with the help of examples from this forum) to correspond with some of the MT4 functions. Those of you who're good at coding in MT4 and JForex, please make suggestions or contribute here:
NormalizeDouble( , ) double NormalizeDouble(double operand, int numofdigits) {
if(numofdigits>5) numofdigits=5;
String decimalplaces="###0.";
for(int i=0; i<numofdigits; i++){
decimalplaces += "0";
}
DecimalFormat applydeci = new DecimalFormat(decimalplaces);
Double result = new Double(applydeci.format(operand)).doubleValue();
return(result);
}
DayOfWeek( )int DayOfWeek(long currtime) {
// You have to pass tick.getTime() as the parameter currtime
Calendar newCal = Calendar.getInstance(TimeZone.getTimeZone("GMT 0"));
newCal.setTimeInMillis(currtime);
int daynum = newCal.get(Calendar.DAY_OF_WEEK);
return(daynum);
}
Hour( )int Hour(long currtime){
// Similar to DayOfWeek, pass tick.getTime() as the parameter currtime
Calendar newCal = Calendar.getInstance(TimeZone.getTimeZone("GMT 0"));
newCal.setTimeInMillis(currtime);
int hour = newCal.get(Calendar.HOUR_OF_DAY);
return(hour);
}
Minute( )int Minute(long currtime){
// Similar to DayOfWeek, pass tick.getTime() as the parameter currtime
Calendar newCal = Calendar.getInstance(TimeZone.getTimeZone("GMT 0"));
newCal.setTimeInMillis(currtime);
int mins = newCal.get(Calendar.MINUTE);
return(mins);
}