how i calculate a percent of account in volume to invest in an open position?

Created at 29 May 2014, 21:18
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Paulo_Lira's avatar

Paulo_Lira

Joined 12.02.2014

how i calculate a percent of account in volume to invest in an open position?
29 May 2014, 21:18


how i calculate a percent of account in volume to invest in an open position?


@Paulo_Lira
Replies

modarkat
30 May 2014, 09:38

Calculating Volume based on fixed risk and stop loss

        private long GetVolume(double risk, int stopLossPips)
        {
            var moneyToInvestInDepositCurrency = Account.Balance * risk;
            var moneyToInvestInQuoteCurrency = moneyToInvestInDepositCurrency / (Symbol.PipValue / Symbol.PipSize);
            var volume = moneyToInvestInQuoteCurrency / (stopLossPips * Symbol.PipSize);
            var normalizedVolume = Symbol.NormalizeVolume(volume);

            return normalizedVolume;
        }

example of usage with risk 25% and SL 10 pips

            var risk = 0.25;
            var stopLossPips = 10;
            var volume = GetVolume(risk, stopLossPips);
            
            ExecuteMarketOrder(TradeType.Buy, Symbol, volume, null, stopLossPips, null);

 


@modarkat

Paulo_Lira
30 May 2014, 14:27

you r a crack!!


@Paulo_Lira

modarkat
03 Mar 2015, 17:57

Calculating SL pips based on SL in deposit currency and Volume:

var moneyToInvestInQuoteCurrency = moneyToInvestInDepositCurrency / (Symbol.PipValue / Symbol.PipSize);
var stopLossPips = moneyToInvestInQuoteCurrency / (volume * Symbol.PipSize)

 


@modarkat