Account.Balance /1000

29 Dec 2016, 05:24Account.Balance /1000#1
irmscher9posts: 20since: 22 Dec 2016

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

09 Jan 2017, 00:52#2
flanneryposts: 4since: 25 Jul 2014

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