Bollinger bandwidth indicator with dynamic lines for bulge and squeeze

Forums ProRealTime English forum ProBuilder support Bollinger bandwidth indicator with dynamic lines for bulge and squeeze

  • This topic has 1 reply, 2 voices, and was last updated 2 years ago by avatarJS.
Viewing 2 posts - 1 through 2 (of 2 total)
  • #185506

    Hi All,

    Hope you are well. I am trying to replicate the attached Bollinger bandwidth indicator seen from tradingview and scripted as below:

    A similar indicator on PRT only has the bandwidth oscillator without the marker lines for the lowest or highest of the previous lookback periods. Therefore i have been manually applying the horizontal lines for each market that i am looking at, which is a bit of work.

    I appreciate anyone who can help with the code for this indicator. Let me know if you need more informaion.

    Thank you,

    Yomi

    =======================================

    //@version=4
    study(title = “Bollinger Bandwidth – Bulge and squeeze”, shorttitle = “Bollinger Bandwidth”, format=format.price, precision=2, resolution=””)
    length = input(20, minval=1)
    src = input(close, title=”Source”)
    mult = input(2.0, minval=0.001, maxval=50, title=”StdDev”)
    highlowlength = input(20, minval=1, title=”High Low Lookback Short”)
    [main, top, bottom] = bb(src, length, mult)
    bandwidth = (top-bottom)/main
    short_lowest = lowest(bandwidth, highlowlength)
    short_highest = highest(bandwidth, highlowlength)

    plot(bandwidth, “Bollinger Bandwidth”, color=color.blue)
    p1 = plot(short_highest, color=color.green, title=”Lowest”)
    p2 = plot(short_lowest, color=color.red, title=”Highest”)

    fill(p1, p2, color = bandwidth> short_lowest? color.green : color.red, title=”Background”)

    ==========================================

    #185609
    JS

    Hi @yomisadiku

Viewing 2 posts - 1 through 2 (of 2 total)

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