Decimals

Category: Constants

The Decimals function in ProBuilder language is used to determine the number of decimal places in the current instrument’s value where the code is applied. This function is particularly useful when you need to understand the precision of a value or when formatting output for display purposes.

Syntax:

Decimals

Example:

numDecimals = Decimals
// The variable numDecimals now holds the number of decimal places for the current instrument.

In this example, the Decimals function is used to determine how many decimal places the current instrument’s value has. The result is stored in the variable numDecimals.

Additional Information:

  • The function returns an integer representing the number of decimal places.
  • If the current instrument’s value is an integer (e.g., 100), the function will return 0 since there are no decimal places.
  • This function can be very helpful in financial and scientific calculations where the precision of decimal places matters.

Understanding the number of decimals in a value can help in ensuring that calculations are performed accurately, especially when dealing with monetary values or precise measurements in trading algorithms.

Logo Logo
Loading...