Hello im trying to write a function which calculates the correct lay stake unfortunately I have it working however it doesn't correctly take into account the commission. Can anybody help?
Code:
static public double CalculateHedgeLayStake(double backOdds, double layOdds, double backAmount = 1.0f, double backComission = 5.0f, double layComission = 5.0f)
{
double backComissionDecimal = backComission/100.0f;
double layComissionDecimal = layComission/100.0f;
double backWin = ((backAmount * (backOdds - 1.0f)) * (1.0f - backComissionDecimal));
double layWin = backAmount * (1.0f - layComissionDecimal);
double backLose = -backAmount;
double layLose = backAmount * (layOdds-1.0f);
double betWins = backWin - layLose;
double betLoses = layWin - backLose;
return backAmount + (betWins / layOdds);
}


Comment