Esempio n. 1
0
        /// <summary>Choose a volume such that the 'distance' (in base currency) has a value approximately equal to 'balance_pc' percent of the current balance</summary>
        public long CalculateVolume(Instrument instrument, double distance)
        {
            var pd = instrument.PriceData;

            // The amount of base currency to base the volume on
            var amount = Misc.AcctToBaseCurrency(Acct.Balance * Settings.Trade.RiskFracPerTrade, pd) * Acct.Leverage;

            // The value is the change of 'distance' * volume.
            // We want to choose volume such that abs(value - amount) is minimised

            //volume = amount / distance;

            //var pd = instrument.PriceData;
            //var d = pd.PipValue * distance;
            return(0);
        }