Printing numbers DRAWTEXT

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #155798 quote
    NewbieNewbie
    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
    VonasiVonasi
    Moderator
    Master

    The ProRealCode documentation is your friend!

    ROUND

    CEIL

    FLOOR

    Newbie thanked this post
    #155883 quote
    NewbieNewbie
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 NewbieNewbie
5 years, 8 months ago.

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