Could someone convert Wave-PM from TradingView?

S

superfatkorean

New member
The indicator is Wave-pm and I honestly think its the best volatility indicator there is. If someone could help me translate this into think script It would be awesome :D.


Code:
study("Wave-PM")

fastPeriod = input(14, "Fast Period", input.integer, minval=5, maxval=1000)
slowPeriod = input(55, "Slow Period", input.integer, minval=5, maxval=1000)
slowerPeriod = input(100, "Slow Period", input.integer, minval=5, maxval=1000)
multiplier = input(2.2, "Stddev Multiplier", input.float, minval=1, maxval=5)

wpm(length) =>
    dev = multiplier * stdev(close, round(length))
    dev1 = pow(dev / syminfo.pointvalue, 2)
    temp = sqrt(sma(dev1, 100)) * syminfo.pointvalue
    temp := temp != 0  ? dev/temp : temp
    return = if temp > 0
        iexp = exp(-2*temp)
        (1-iexp)/(1+iexp)
    else
        iexp = exp(2*temp)
        (iexp-1)/(1+iexp)

val1 = wpm(fastPeriod)
val2 = wpm(slowPeriod)
val3 = wpm(slowerPeriod)


plot(val1, title="Fast", color=color.red, style=plot.style_line, linewidth=2)
plot(val2, title="Slow", color=color.blue, style=plot.style_line, linewidth=2)
plot(val3, title="Slower", color=color.yellow, style=plot.style_line, linewidth=2)


hline(0.9, title="Danger", color=color.red, linestyle=hline.style_dotted)
hline(0.7, title="Breakout", color=color.red, linestyle=hline.style_dotted)
hline(0.5, title="Consolidation", color=color.red, linestyle=hline.style_dotted)
hline(0.35, title="Gear Change", color=color.red, linestyle=hline.style_dotted)
I came across wave-pm from crypto traders but never seen it used on stocks. Originally made for forex by mark whistler. The indicator aims to detect the weight of the pairs trading. Its like a rsi with no directional signal rather a prediction of volatility . I plan to use this on tos so I can scan penny stocks since I think this indicator does exceptionally well. The only problem being the window of entry being very short.
 
Last edited by a moderator:
zeek

zeek

Active member
2019 Donor
I hope someone can help converting this, would like to try it.
 
S

superfatkorean

New member
im converting it rn. The built in functions on tos is different than trading view so it might take sum time :C.
 
S

superfatkorean

New member
Wave-pm is basically a normalized version of bollinger band width. So if you just want to scan you can just use bbw crosses.
 

Similar threads

Top