Remove numbers after the decimal point
Forums › ProRealTime English forum › ProBuilder support › Remove numbers after the decimal point
- This topic has 6 replies, 4 voices, and was last updated 1 year ago by Marcel van Vliet.
-
-
10/20/2023 at 6:41 PM #222699Bull/Bear volume1
Hi, Another question from a hopeless programmer.
I have tried to remove (or hide) the numbers after the decimal point for the Bull/Bear volume indicator (picture).
I added the comment ‘Decimal [0]’ to the code, but without result. Can anybody help me out?
Here is the code:
Bull/Bear volume12345678910111213141516171819202122ref=(close-low)/rangevolbull=ref*volumevolbear=volumeif close>=open thengreenbarcount=1greenvolume=volumecomplete=Decimals[0]redbarcount=0redvolume=0elsegreenbarcount=0greenvolume=0redbarcount=1redvolume=volumecomplete=Decimals[0]endif//media volumi rossi e verdi per media mobile semplicemmred=summation[period](redvolume)/summation[period](redbarcount)mmgreen=summation[period](greenvolume)/summation[period](greenbarcount)return volbear coloured (204,0,0) style (histogram), volbull coloured (0,51,153) style (histogram), mmred coloured (204,51,0) as "Bear average", mmgreen coloured (0,51,153) as "Bull average"10/20/2023 at 6:57 PM #222704Topic moved from proscreener forum to probuilder forum
Round, or Floor, or Ceil… depending on if you want closest integer, integer below, or integer above…
Examples:
round(mmred)
https://www.prorealcode.com/documentation/round/
Ceil(mmred)
https://www.prorealcode.com/documentation/ceil/
Floor(mmred)
10/20/2023 at 7:00 PM #222706????? Just want to remove the decimals as shown on the attached picture. Sorry but your reply make no sense to me.
10/20/2023 at 7:16 PM #222708First, delete both complete=decimal[0] lines, they don’t do anything
Second, replace the return line (number 22) with this one instead, adding everywhere inside it the ROUND keyword from above reply :
return ROUND(volbear) coloured (204,0,0) style (histogram), ROUND(volbull) coloured (0,51,153) style (histogram), ROUND(mmred) coloured (204,51,0) as “Bear average”, ROUND(mmgreen) coloured (0,51,153) as “Bull average”
1 user thanked author for this post.
10/21/2023 at 10:46 AM #222720Hi Marcel,
There is no instruction in PRT to remove the decimals…
What you can do is use the instruction Round(a, digits) (as JC indicates), with which you can round the number to the nearest whole number and optional indicate with “digits” how many decimal places you want to see…
1 user thanked author for this post.
10/21/2023 at 3:47 PM #22274410/23/2023 at 12:53 PM #222820I copied/paste the suggestion return rule from the reply of #JC Bywan and it works fine. Thanks for your thoughts ……….
-
AuthorPosts
Find exclusive trading pro-tools on