For currency pair 'instrument' I calculate OrderAmount to Trade with the following code, assuming I want to Risk 80% of my Equity (which is ok for the Strategy Contest):
@Configurable("%Equity to Risk") public double EQpcAmount = 80;
JFUtils utils = context.getUtils();
double EquityInUSD = history.getEquity()*utils.getRate(JFCurrency.getInstance(String.valueOf(context.getAccount().getCurrency())),JFCurrency.getInstance("USD"));
double OrderAmount = roundDecimals(EquityInUSD/1000000)*(EQpcAmount/100)*context.getAccount().getLeverage(), instrument.getPipScale()+1);
@Configurable("%Equity to Risk") public double EQpcAmount = 80;
JFUtils utils = context.getUtils();
double EquityInUSD = history.getEquity()*utils.getRate(JFCurrency.getInstance(String.valueOf(context.getAccount().getCurrency())),JFCurrency.getInstance("USD"));
double OrderAmount = roundDecimals(EquityInUSD/1000000)*(EQpcAmount/100)*context.getAccount().getLeverage(), instrument.getPipScale()+1);