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.
Decimals
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.
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.