Horizontal lines at round numbers

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #53253 quote
    AlcoAlco
    Participant
    Senior

    Could someone help me to draw lines on round numbers with a code?

    For example: 

    1.1600
    1.1650
    1.1700

    Thanks

    #53300 quote
    LeoLeo
    Participant
    Veteran
    very simple  
    retourn 1.1600,1.650, 1.1700
    
    All the People here is eager to help you but you should do first your homework: read, learn and practice a lot. Kind Regards
    #53324 quote
    NicolasNicolas
    Keymaster
    Legend
    Maybe Alco want them to be drawn automatically, each 50 points, starting from a round number?
    #53779 quote
    AlcoAlco
    Participant
    Senior

    Yes Nicolas, that’s what i mean.

    #53790 quote
    NicolasNicolas
    Keymaster
    Legend

    I made a French video before new graphical instructions, so it’s a bit messy on chart, but that was a good code before that: https://www.prorealcode.com/blog/video-tutorials/trading-des-chiffres-ronds-grace-a-probuilder/

    Here is the code: 

    //round number to nearest upper 25
    roundnumber = 50
    
    for i = 1 to roundnumber do
    if (close+i*pointsize) mod roundnumber*pointsize = 0 then
    upper = round(close+i*pointsize)
    if upper mod roundnumber = 1 then
    upper = upper-1
    endif
    break
    endif
    next
    
    for i = roundnumber downto 1 do
    if (close-i*pointsize) mod roundnumber*pointsize = 0 then
    lower = round(close-i*pointsize)
    if lower mod roundnumber = 1 then
    lower = lower-1
    endif
    break
    endif
    next
    
    for i = 1 to roundnumber do
    if (upper+i*pointsize) mod roundnumber*pointsize = 0 then
    upper1 = round(upper+i*pointsize)
    if upper1 mod roundnumber = 1 then
    upper1 = upper1-1
    endif
    break
    endif
    next
    
    for i = roundnumber downto 1 do
    if (lower-i*pointsize) mod roundnumber*pointsize = 0 then
    lower1 = round(lower-i*pointsize)
    if lower1 mod roundnumber = 1 then
    lower1 = lower1-1
    endif
    break
    endif
    next
    
    
    return upper, lower, upper1, lower1
    

    I’m sorry, very busy now so I can’t transform it now with DRAWSEGMENT or DRAWHLINE, maybe someone could help?

    round-number-grid-on-chart.png round-number-grid-on-chart.png
Viewing 5 posts - 1 through 5 (of 5 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

Horizontal lines at round numbers


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Alco @alco_aarts Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by NicolasNicolas
8 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/19/2017
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...