Account.Balance /1000

Created at 29 Dec 2016, 05:24
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!
irmscher9's avatar

irmscher9

Joined 22.12.2016

Account.Balance /1000
29 Dec 2016, 05:24


Hey guys

I would like to divide current account balance by 1000, round it up so that it's an integer (whole number like "2" instead of 2.34566)

and store it in a variable so that I can use it as a multiplier later to multiply the initialVolume in the ExecuteMarketOrder

How do I do that?

Cheers


@irmscher9
Replies

flannery
09 Jan 2017, 00:52

Hi irmscher9

 

This is what I use.

 

double accBalance;
int Volume;

public void beregn_volume()
        {
            accBalance = Account.Balance;
            Volume = Convert.ToInt32(Math.Round(accBalance  / 1000.0, 0));
            Print("Volume: " + Volume);
        }

 

Best Regards

Flannery


@flannery