Sum of Digits of Index Closing Price

Forums ProRealTime English forum ProOrder support Sum of Digits of Index Closing Price

Viewing 4 posts - 1 through 4 (of 4 total)
  • #168293

    I have been looking at the mathematical functions but unfortunately I cannot find the mathematical formula for sum of digits e.g. 6939 = 6+9+3+9 = 27

    For example, if I want to code the sum of digits for an index price re FTSE 100 at close, 6939, what will be the formula in code? Kindly help please.

    #168298

    There’s no built-in function to manipulate single digits.

    You can achieve that by a doing some divisions and multiplications by ten, then rounding the number to subtract the result from the original number to get the desired digit:

     

    #168299

    Roberto, thanks for your prompt reply and this is really helpful.

     

    1 user thanked author for this post.
    #168300

    The correct comment in line 7 is:

     

Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login