I wrote it as follows. But there is something wrong. Please, help me correct it
private long MAXLOT(double ml, double cap)
{
var lvr = Account.Leverage;
var FM = Account.FreeMargin;
var AE = Account.Equity; long xx = 0; double ER = AE * (1 - (CapUse / 100)); double EU = FM - ER;
var MaxLot = EU * lvr / (Symbol.Ask * Symbol.LotSize); if (MaxLot > ml)
{
var lot = Symbol.NormalizeVolume(MaxLot, RoundingMode.ToNearest);
xx = Symbol.QuantityToVolume(lot);
}
return (xx);
}
kamol
06 May 2015, 16:11
I wrote it as follows. But there is something wrong. Please, help me correct it
private long MAXLOT(double ml, double cap)
{
var lvr = Account.Leverage;
var FM = Account.FreeMargin;
var AE = Account.Equity;
long xx = 0;
double ER = AE * (1 - (CapUse / 100));
double EU = FM - ER;
var MaxLot = EU * lvr / (Symbol.Ask * Symbol.LotSize);
if (MaxLot > ml)
{
var lot = Symbol.NormalizeVolume(MaxLot, RoundingMode.ToNearest);
xx = Symbol.QuantityToVolume(lot);
}
return (xx);
}
@kamol