Hurst Bands/Hurst Oscillator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #37430 quote
    denmar
    Participant
    Veteran

    Hi everybody, anybody willing to have a bash at converting this code (Pine Script)  – link: https://www.tradingview.com/script/yl3pK2zM-Indicators-Hurst-Bands-and-Hurst-Oscillator/

    Thanks

    //
    // @author LazyBear
    //
    // If you use this code in its original/modified form, do drop me a note. 
    //
    study("Hurst Bands [LazyBear]", shorttitle="H%Bands_LB", overlay=true)
    price = hl2
    length = input(10, title="Displacement length")
    InnerValue = input(1.6, title="Innerbands %")
    OuterValue = input(2.6, title="Outerbands %")
    ExtremeValue = input(4.2, title="Extremebands %")
    showExtremeBands = input(false, type=bool, title="Display Extreme Bands?")
    showClosingPriceLine = input(false, type=bool, title="Plot Close price?")
    smooth = input(1, title="EMA Length for Close")
    
    displacement = (length / 2) + 1
    dPrice = price[displacement]
    
    CMA = not na(dPrice) ?  sma(dPrice, abs(length)) : nz(CMA[1]) + (nz(CMA[1]) - nz(CMA[2]))
     
    CenteredMA=plot(not na(dPrice) ? CMA : na, color=blue , linewidth=2)
    CenterLine=plot(not na(price) ? CMA : na, linewidth=2, color=aqua)
    
    ExtremeBand = CMA * ExtremeValue / 100
    OuterBand   = CMA * OuterValue / 100
    InnerBand   = CMA * InnerValue / 100
    
    UpperExtremeBand=plot(showExtremeBands and (not na(price)) ? CMA + ExtremeBand : na)
    LowerExtremeBand=plot(showExtremeBands and (not na(price)) ? CMA - ExtremeBand : na)
    UpperOuterBand=  plot(not na(price) ? CMA + OuterBand : na)
    LowerOuterBand=  plot(not na(price) ? CMA - OuterBand : na)
    UpperInnerBand=  plot(not na(price) ? CMA + InnerBand : na)
    LowerInnerBand=  plot(not na(price) ? CMA - InnerBand : na)
    
    fill(UpperOuterBand, UpperInnerBand, color=red, transp=85)
    fill(LowerInnerBand, LowerOuterBand, color=green, transp=85)
    
    FlowValue = close > close[1] ? high : close < close[1] ? low : hl2
    FlowPrice = plot(showClosingPriceLine ? sma(FlowValue, smooth) : na, linewidth=1)
    
    #37603 quote
    Nicolas
    Keymaster
    Master

    This code is only about the Hurst bands (not the oscillator on the screenshot you provided), do you only want this one to be converted? Otherwise, please provide the code also for the oscillator one.

    #37609 quote
    denmar
    Participant
    Veteran

    The bands would be great Nicolas. Thanks.

    #37691 quote
    Nicolas
    Keymaster
    Master

    Please find attached the translated version of the Hurst Bands. I’ll make a better version with color and proper lines formatting later to add it into the library.

    bolsatrilera thanked this post
    #37695 quote
    denmar
    Participant
    Veteran

    Thank you kindly Nicolas.

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

Hurst Bands/Hurst Oscillator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
denmar @denmar Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by denmar
8 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/05/2017
Status: Active
Attachments: 3 files
Logo Logo
Loading...