DrawRectangle OPen till Close

Forums ProRealTime English forum ProBuilder support DrawRectangle OPen till Close

Viewing 3 posts - 1 through 3 (of 3 total)
  • #216313

    HI

    am looking for help on regards the DRAWRECTANGLE function

    Would like to paint a rectangle between two prices. e.g. 1 and 2.

    and the width of the rectangle should be from OPEN to CLose (or 5 bars into the future)

    Somehow I cant get this managed with Barindex and co,

    Can someone help me ?

    #216315

    A rectangle is plotted according to two coordinates:

    • price (from price 1 to price 2)
    • bars (from bar 1 to bar 2), which can also be in the future, if you like.

    The line width is specified by a numeric constant, not a price:

     

     

    1 user thanked author for this post.
    #220897

    Thanks.. i solved it like this

    defparam DRAWONLASTBARONLY = true

    mintimeFrame = 9

    if GetTimeFrame/60 >= minTimeFrame then

    maxCheck = 50
    i = 0
    lastOuterBar = -1

    lastLow = low[maxcheck]
    lastHigh = high[maxcheck]

    for i = maxCheck-1 downto 0
    if open[i] >= lastHigh or open[i] =< lastLow or close[i] >= lastHigh or close[i] =< lastLow then
    lastLow = low[i]
    lastHigh = high[i]
    lastOuterBar = i
    endif
    next

    if lastOuterBar > 0 then

    x1 = barindex
    y1 = high[lastOuterBar] //high[barindex+1]
    x2 = barindex-lastOuterBar
    y2 = low[lastOuterBar]//low[barindex+1]
    DRAWRECTANGLE(x1, y1, x2,y2) coloured(255,155,0)FILLCOLOR(255,255,230)
    endif
    endif

    RETURN

    1 user thanked author for this post.
Viewing 3 posts - 1 through 3 (of 3 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login