Printing numbers DRAWTEXT

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #155798 quote
    Newbie
    Participant
    Average

    Greetings Team

    I’m looking for any help on drawing numbers. The first part is drawing a whole number and the second is how to limit decimal places?

    defparam drawonlastbaronly=true
     
    If Year<>Year[1] then
     yearlyClose = close[1]
     yearlyHigh = Highest[BarIndex - lastYearBarIndex](High)[1]
     yearlyLow = Lowest[BarIndex - lastYearBarIndex](Low)[1]
     lastYearBarIndex = BarIndex
    endif
     
    drawtext("_PH #yearlyHigh#",barindex,yearlyhigh) coloured(204,0,204)
    drawtext("_PC #yearlyClose#",barindex,yearlyclose) coloured(204,0,204)
    drawtext("_PH #yearlyLow#",barindex,yearlylow) coloured(204,0,204)
    return

    My question is; how is it possible to print the price to either a whole number with NO decimal places, OR to say within 2 decimal places e.g. 12,161.00

    I know in excel for example it’s possible to format cells to display information as XXX.XXX

    Is this possible in PRC? If so, how?

     

    Thank you for help in advance 🙂

    #155800 quote
    Vonasi
    Moderator
    Master

    The ProRealCode documentation is your friend!

    ROUND

    CEIL

    FLOOR

    Newbie thanked this post
    #155883 quote
    Newbie
    Participant
    Average

    @Vonasi Thank you… I must have missed those in the repository! But they’re just perfect. I’ll get working to put them to good use.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Printing numbers DRAWTEXT


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Newbie @newbie Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Newbie
5 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/31/2020
Status: Active
Attachments: No files
Logo Logo
Loading...