Rob Hoffman Inventory Retracement Bars

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #188512 quote
    Mary
    Participant
    Average

    Could someone please translate Tradingview’s Rob Hoffman Inventory Retracement Bar Indicator to Prorealtime. Code in Tradingview is as follows:

    study(“Rob Hoffman – Overlay Set”, shorttitle = “RH – MAs”, overlay = true)

    a = sma(close,3)
    b = sma(close,5)

    c = ema(close,18)
    d = ema(close,20)

    e = sma(close,50)
    f = sma(close,89)
    g = ema(close,144)
    h = sma(close,200)

    k = ema(close,35)
    r = rma(tr,35)
    ku = k + r*0.5
    kl = k – r*0.5

    plot(a, title = “Fast Speed Line”, linewidth = 2, color = #0000FF)
    plot(b, title = “Slow Speed Line”, linewidth = 2, color = fuchsia)
    plot(c, title = “Fast Primary Trend Line”, linewidth = 3, color = #00FF00)
    plot(d, title = “Slow Primary Trend Line”, linewidth = 3, color = #000000)
    plot(e, title = “Trend Line – 1”, linewidth = 3, color = #0000FF, style = circles)
    plot(f, title = “Trend Line – 2”, linewidth = 3, color = #20B2AA)
    plot(g, title = “Trend Line – 3”, linewidth = 3, color = #FF4500)
    plot(h, title = “Trend Line – 4”, linewidth = 3, color = fuchsia)

    plot(k, title = “No Trend Zone – Midline”, linewidth = 2, color = #3CB371)
    plot(ku, title = “No Trend Zone – Upperline”, linewidth = 2, color = #3CB371)
    plot(kl, title = “No Trend Zone – Lowerline”, linewidth = 2, color = #3CB371)

    #188526 quote
    robertogozzi
    Moderator
    Master

    The code you posted is the Rob Hoffman – Overlay Set (https://it.tradingview.com/script/al4ABhwU-Rob-Hoffman-Overlay-Set/):

    // Rob Hoffman - Overlay Set
    //
    // https://it.tradingview.com/script/al4ABhwU-Rob-Hoffman-Overlay-Set/
    // https://www.prorealcode.com/topic/rob-hoffman-inventory-retracement-bars/
    //
    Asma = average[3,0](close)
    Bsma = average[5,0](close)
    
    Csma = average[18,0](close)
    Dsma = average[20,0](close)
    
    Esma = average[50,0](close)
    Fsma = average[89,0](close)
    Gsma = average[144,0](close)
    Hsma = average[200,0](close)
    
    Kema = average[35,1](close)
    Rrma, ignored = CALL "Rma"[10,1] //https://www.prorealcode.com/prorealtime-indicators/rma-recursive-moving-average/
    Ku   = Kema + (Rrma * 0.5)
    Kl   = Kema - (Rrma * 0.5)
    
    RETURN Asma AS "Fast Speed Line",Bsma AS "Slow Speed Line",Csma AS "Fast Primary Trend Line",Dsma AS "Slow Primary Trend Line",Esma AS "Trend Line - 1",Fsma AS "Trend Line - 2",Gsma AS "Trend Line - 3",Hsma AS "Trend Line - 4",Kema AS "NO Trend Zone - MidLine",Ku   AS "NO Trend Zone - UpperLine",Kl   AS "NO Trend Zone - LowerLine"
    #188546 quote
    Mary
    Participant
    Average

    Hello, Sorry I posted the wrong code for Rob Hoffman Inventory Retracement Bar Indicators

    Here is the correct code from Tradingview, if possible to translate to Prorealtime:

    study(title=”UCS_Rob Hoffman_Inventory Retracement Bar”, shorttitle=”UCS_RH_IRB”, precision=2, overlay=true)

    z = input(45, title=”Inventory Retracement Percentage %”, maxval=100)

    // Candle Range
    a = abs(high – low)
    // Candle Body
    b = abs(close – open)
    // Percent to Decimal
    c = z/100

    // Range Verification
    rv = b < c*a

    // Price Level for Retracement
    x = low + (c * a)
    y = high – (c * a)

    sl = rv == 1 and high > y and close < y and open < y
    ss = rv == 1 and low < x and close > x and open > x

    // Line Definition
    li = sl ? y : ss ? x : (x+y)/2

    // Plot Statement
    plotshape(sl, style=shape.triangledown, location=location.abovebar, color=red, title = “Long Bar”, transp = 0)
    plotshape(ss, style=shape.triangleup, location=location.belowbar, color=green, title = “Short Bar”, transp = 0)

    plot(li, style = line, color = blue, title = “Inventory Bar Retracement Price Line”)

    #188604 quote
    Nicolas
    Keymaster
    Master

    Here is the translation of this last code about Rob Hoffman inventory retracement bars:

    z = 45//Inventory Retracement Percentage %
    
    // Candle Range
    a = abs(high - low)
    // Candle Body
    b = abs(close - open)
    // Percent to Decimal
    c = z/100
    
    // Range Verification
    rv = b < c*a
    
    // Price Level for Retracement
    x = low + (c * a)
    y = high - (c * a)
    
    sl = rv = 1 and high > y and close < y and open < y
    ss = rv = 1 and low < x and close > x and open > x
    
    // Line Definition
    if sl then 
    li=y
    drawarrowdown(barindex,high) coloured("red")
    elsif ss then 
    li=x
    drawarrowup(barindex,low) coloured("green")
    else
    li=(x+y)/2
    endif
    
    return li
    #188630 quote
    Mary
    Participant
    Average

    Thank you Nicolas,

    its working very well!

    #190585 quote
    faces
    Participant
    New

    please how do i get Rob Hoffman’s overlay and inventory retracement bar for mt4

    #190586 quote
    faces
    Participant
    New

    Please can anyone help me with the Rob Hoffman’s overlay and retracement Bars for mt4?

    thanks you

    #215527 quote
    ayrton
    Participant
    Junior

    hello I used the overlay set of ROB hoffman posted by roberto tot works except this part of code concerning the "no trend zone" the upper band is calculated because if the puts it in histogram they appear but on the whole screen on the other hand nothing n appears for the lower band I imported the code and the rma [10.1] is present

    Kema = average [ 35,1 ] (close )
    Rrma, ignored = CALL "Rma " [ 10,1 ] //https://www.prorealcode.com/prorealtime-indicators/rma-recursive-moving-average/
    Ku   = Kema + (Rrma * 0.5 )
    KL   = Kema- (Rrma * 0.5 )

    can someone help me

    THANKS
    #215627 quote
    robertogozzi
    Moderator
    Master

    @ayrton

    my fault, you are absolutely right. I misread the original code and used CLOSE, instead of TR, for the calculation of RMA.

    This is the new RMA code (I named the file for indicator RmaTR):

    // RMA - Recursive Moving Average (calcolated on TR, instead of CLOSE)
    //
    // https://www.prorealcode.com/topic/media-mobile-ricorsiva/#post-155638
    //
    //N   = 10      //RMA Periods
    //P   = 6       //Smoothing Periods
    N     = max(1,min(999,N))
    P     = max(1,min(999,P))
    myTR  = max(Range,max(abs(high - close[1]),abs(low - close[1])))
    Rma   = 0
    FOR i = N-1 DOWNTO 0
       j = N - i
       Rma = Rma + (summation[j](myTR[i]) / j)
    NEXT
    Rma = Rma / N
    Avg = average[P,0](Rma)
    RETURN Rma as "RmaTR", Avg as "Average RMA"

    and this is the modified Rob Hoffman – Overlay Set indicator, that I named Rob Hoffman – Overlay Set TR:

    // Rob Hoffman - Overlay Set (calculated on TR, instead of CLOSE)
    //
    // https://it.tradingview.com/script/al4ABhwU-Rob-Hoffman-Overlay-Set/
    // https://www.prorealcode.com/topic/rob-hoffman-inventory-retracement-bars/
    //
    Asma = average[3,0](close)
    Bsma = average[5,0](close)
    
    Csma = average[18,0](close)
    Dsma = average[20,0](close)
    
    Esma = average[50,0](close)
    Fsma = average[89,0](close)
    Gsma = average[144,0](close)
    Hsma = average[200,0](close)
    
    Kema = average[35,1](close)
    myTR = max(Range,max(abs(high - close[1]),abs(low - close[1])))
    Rrma, ignored = CALL "RmaTR"[10,1](myTR) //https://www.prorealcode.com/prorealtime-indicators/rma-recursive-moving-average/
    Ku   = Kema + (Rrma * 0.5)
    Kl   = Kema - (Rrma * 0.5)
    
    RETURN Asma AS "Fast Speed Line",Bsma AS "Slow Speed Line",Csma AS "Fast Primary Trend Line",Dsma AS "Slow Primary Trend Line",Esma AS "Trend Line - 1",Fsma AS "Trend Line - 2",Gsma AS "Trend Line - 3",Hsma AS "Trend Line - 4",Kema AS "NO Trend Zone - MidLine",Ku   AS "NO Trend Zone - UpperLine",Kl   AS "NO Trend Zone - LowerLine"

    sorry for the inconvenience.

    #216264 quote
    ayrton
    Participant
    Junior

    hi roberto

     

    thank you very much ,  all it ‘s ok

     

    ERIC

    #221674 quote
    Titodito1
    Participant
    Junior

    Hi Roberto,

    I think that the average in Line 14 of the Overlay is and Exponential Average.

    I am still trying to figure out the reason why this is the only exponential of the 4 averages.

    #221693 quote
    robertogozzi
    Moderator
    Master

    Thank you for pointing that out, I just realized there are 3 EMAs (C, D and G). This is the updated code:

    // Rob Hoffman - Overlay Set
    //
    // https://it.tradingview.com/script/al4ABhwU-Rob-Hoffman-Overlay-Set/
    // https://www.prorealcode.com/topic/rob-hoffman-inventory-retracement-bars/
    //
    Asma = average[3,0](close)
    Bsma = average[5,0](close)
    
    Cema = average[18,1](close)
    Demx = average[20,1](close)
    
    Esma = average[50,0](close)
    Fsma = average[89,0](close)
    Gema = average[144,1](close)
    Hsma = average[200,0](close)
    
    Kema = average[35,1](close)
    Rrma, ignored = CALL "Rma"[10,1] //https://www.prorealcode.com/prorealtime-indicators/rma-recursive-moving-average/
    Ku   = Kema + (Rrma * 0.5)
    Kl   = Kema - (Rrma * 0.5)
    
    RETURN Asma AS "Fast Speed Line",Bsma AS "Slow Speed Line",Cema AS "Fast Primary Trend Line",Demx AS "Slow Primary Trend Line",Esma AS "Trend Line - 1",Fsma AS "Trend Line - 2",Gema AS "Trend Line - 3",Hsma AS "Trend Line - 4",Kema AS "NO Trend Zone - MidLine",Ku   AS "NO Trend Zone - UpperLine",Kl   AS "NO Trend Zone - LowerLine"
    // Rob Hoffman - Overlay Set (calculated on TR, instead of CLOSE)
    //
    // https://it.tradingview.com/script/al4ABhwU-Rob-Hoffman-Overlay-Set/
    // https://www.prorealcode.com/topic/rob-hoffman-inventory-retracement-bars/
    //
    Asma = average[3,0](close)
    Bsma = average[5,0](close)
    
    Cema = average[18,1](close)
    Demx = average[20,1](close)
    
    Esma = average[50,0](close)
    Fsma = average[89,0](close)
    Gema = average[144,1](close)
    Hsma = average[200,0](close)
    
    Kema = average[35,1](close)
    myTR = max(Range,max(abs(high - close[1]),abs(low - close[1])))
    Rrma, ignored = CALL "RmaTR"[10,1](myTR) //https://www.prorealcode.com/prorealtime-indicators/rma-recursive-moving-average/
    Ku   = Kema + (Rrma * 0.5)
    Kl   = Kema - (Rrma * 0.5)
    
    RETURN Asma AS "Fast Speed Line",Bsma AS "Slow Speed Line",Cema AS "Fast Primary Trend Line",Demx AS "Slow Primary Trend Line",Esma AS "Trend Line - 1",Fsma AS "Trend Line - 2",Gema AS "Trend Line - 3",Hsma AS "Trend Line - 4",Kema AS "NO Trend Zone - MidLine",Ku   AS "NO Trend Zone - UpperLine",Kl   AS "NO Trend Zone - LowerLine"
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

Rob Hoffman Inventory Retracement Bars


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Mary @mila Participant
Summary

This topic contains 11 replies,
has 6 voices, and was last updated by robertogozzi
2 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/19/2022
Status: Active
Attachments: 7 files
Logo Logo
Loading...