hello support,
i try to manage my risk in my strategy with a sample way, but i have a problem with my cycle.
the scenario is simple : with a winner trade, i increments my risk by one. with a loser trade , i decrease my risk by one.
but the cycle repeats itself because stategy returns to "void onaccount". so i would like that the strategy enters the cycle once.
could you help me please?
@Override
public void onAccount(IAccount account) throws JFException {
double riskmax = 4;
double riskAddLess = 1;
double riskmin = 1;
double baseBalance = account.getBalance();
double currentBalance = account.getBaseEquity();
for(int ip=0;ip<1;ip++){
if (order.getState() == IOrder.State.CLOSED){
if(baseBalance < currentBalance && risk < riskmax){
risk = risk + riskAddLess;
}else if(baseBalance > currentBalance && risk > riskmin){
risk = risk - riskAddLess;
}
}
}
print("risk:" +risk);
}
thank.
eric