draw vertical segment for reversal bar ?

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #207814 quote
    sharteel
    Participant
    Junior

    Hello,

    timeframe: 1 tick

    i start a new challenge and for that i m looking if someone has a code for drawing a vertical segment in tick timeframe where the high or low is moving with tick value (price) only. dont care about the time.

    ex:

    • tick reversal: +10ticks
    • the price start at 11000, the price up, the green segments drawing up until the price down to value = to 10 tick and it is the start for drawginf the new bar, red here as the price move down. if the price move up again to +10 tick, the draw a new green bar.

    it is reversal bar.

    thanks.

    S.T

    #208082 quote
    Nicolas
    Keymaster
    Master

    Sorry I don’t get it. Can you reformulate the query?

    #208153 quote
    sharteel
    Participant
    Junior

    Hello Nicolas,

    the goal is to draw a bar (vertical segment) until the retracement. it is same thing of renko but with reversal mecanism.

    ex:

    a bar is created in tick chart at time 090000 and move up until price down to 10 ticks. if not, the segment is drawing by following the price.  if the price move down for 10 ticks, a new segment is drawing and continue to draw until the price move up agin and reach last price +10 ticks. etc.

    in attachment with mecanism.

    cheers.

    #208183 quote
    Nicolas
    Keymaster
    Master

    Ok but the bars should look like regular candlesticks or barchart right?

    #208190 quote
    Nicolas
    Keymaster
    Master

    Quickly, I coded this:

    size = 10
    
    once s=size*pointsize 
    once iprice = close
    
    while close>iprice+s do
    iprice=close
    wend
    
    while close<iprice-s do 
    iprice=close
    wend
    
    return iprice

    But I have a doubt, I go back there.. I believe that the line must continue in the same direction until a reversal of X (10) points, is not it?

    #208197 quote
    Nicolas
    Keymaster
    Master

    New version, I think it’s the closest to your query.

    size = 10
    
    once s=size*pointsize 
    once iprice = close
    
    while high>iprice+s do
    iprice=close
    dir = 1
    r=0
    g=255
    wend
    
    while low<iprice-s do 
    iprice=close
    dir = -1
    r=255
    g=0
    wend
    
    if dir=1 then
    iprice=max(iprice,high)
    elsif dir=-1 then
    iprice=min(iprice,low)
    endif
    
    return iprice coloured(r,g,0) style(line,2)
    #208224 quote
    sharteel
    Participant
    Junior

    Hello Nicolas,

    i m looking. i have infinite loop currently.

    below the screen updated with white line and thevergacal bar must be  go.

    appreciate your help.

    Cheers.

    #208230 quote
    Nicolas
    Keymaster
    Master

    ok, but since we can’t modify the time line of the platform (X-axis), I have to build arrays of candlesticks and plot them back in the past, more tricky but will do. So you will not be able to compare the price chart with the new candlesticks the code will plot, they will be both out of sync.

    If you encounter infinite loop, I think it’s because you are using a timeframe too high to get a 10 points retracement in the same bar, please try with DAX / 5 ticks for example. What instrument are you trying?

    #208233 quote
    Nicolas
    Keymaster
    Master

    Here is a more complete version where you can select the display of the bars in 2 different modes: line mode (like previous code) or bars mode.

    In bars mode (mode = 1), you can select if the bars are anchored on the time of their creation or like a classic chart (one bar per time period). See pictures attached for a better understanding.

    sharteel thanked this post
    #208282 quote
    sharteel
    Participant
    Junior

    Hello Nicolas,

    the scale mode is very useful !!!

    do u think u can add an option for drawing a line from low to high and high to low when we are in scale mode ( true reversal mecanism) ?

    Cheers.

    #208385 quote
    Nicolas
    Keymaster
    Master

    Could you explain with a drawing? It worked well last time 😉

    #208862 quote
    Nicolas
    Keymaster
    Master

    Please find attached a modified version, that get rid of the infinite loop issue. Please do your own test in live to make sure all is ok.

    #209801 quote
    sharteel
    Participant
    Junior

    Hello Nicolas,

    thanks for delivery. i m looking.

     

    have a nice day.

     

    cheers.

     

    S.T

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

draw vertical segment for reversal bar ?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
sharteel @sharteel Participant
Summary

This topic contains 12 replies,
has 2 voices, and was last updated by sharteel
2 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/21/2023
Status: Active
Attachments: 9 files
Logo Logo
Loading...