Topics
28 Apr 2015, 17:42
 3142
 3
03 Feb 2015, 12:58
 2390
 2
Replies

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