Horizontal lines at round numbers

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #53253 quote
    Alco
    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
    Leo
    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
    Nicolas
    Keymaster
    Master
    Maybe Alco want them to be drawn automatically, each 50 points, starting from a round number?
    #53779 quote
    Alco
    Participant
    Senior

    Yes Nicolas, that’s what i mean.

    #53790 quote
    Nicolas
    Keymaster
    Master

    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?

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

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 Nicolas
8 years, 2 months ago.

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