ROUNDEDUP is a function in the ProBuilder language used primarily to round up numerical values, typically quantities of stocks to be bought or sold when dealing with cash-based transactions. This function ensures that any fractional part of a number is rounded up to the nearest whole number, which is particularly useful in trading scenarios where partial shares cannot be purchased or sold.
ROUNDEDUP(value)
myCash = 1000
stockPrice = 123.45
maxShares = ROUNDEDUP(myCash / stockPrice)
In this example, the ROUNDEDUP function is used to calculate the maximum number of shares that can be bought with 1000 units of cash at a stock price of 123.45. The division of myCash by stockPrice typically results in a fractional number, and ROUNDEDUP ensures this number is rounded up to the nearest whole number, allowing for the purchase of whole shares only.
This function is straightforward but essential for trading algorithms and financial calculations where rounding up to the nearest whole number is necessary.