Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- //@author=cI8DH
- //original code by cI8:DH, I've just added hull moving average
- study("RSI Candles [cI8DH]", shorttitle="RSIC [cI8DH]", precision=0)
- std = input(false, title="Show Standard RSI")
- candles = input(true, title="Show Candles")
- src = input(close, title="Source")
- len = input(14, minval=1, title="Length")
- hmalength = input(144, title="hull MA length")
- inner = input("Disable", title="Inner Band", options=["Dynamic", "Fixed", "Disable"])
- inner_type = input("Standard Deviation", options=["Standard Deviation", "Smoothed Moving Average"], title="Dynamic inner band calculation method")
- inner_mult = input(1.0, minval=0.0, step=0.2, title="Inner band width (Sideways band)")
- norm = if std
- 1
- else
- avg(src,src[1])
- gain_loss = change(src)/norm
- RSI = 50+50*rma(gain_loss, len)/rma(abs(gain_loss), len)
- RSI_ch = if inner!="Disable"
- if inner_type=="Standard Deviation"
- stdev(abs(change(RSI)), len)
- else
- rma(abs(change(RSI)), len)
- plotcandle(candles?RSI[1]:na, candles?RSI:na, candles?RSI[1]:na, candles?RSI:na, title='RSI', color = src > src[1] ? #65D25Bff : #FE6B69ff, wickcolor=#88888800)
- plot(candles ? na : RSI, color=#a64d79ff, title="RSI")
- os = input(30,title="OverSold")
- ob= input(70,title="Overbought")
- fill(hline(os),hline(ob),color=#a64d7922, title="RSI Band")
- inner_high = plot(inner=="Disable" ? na : 50+inner_mult*(inner=="Dynamic" ? RSI_ch : 5.0), color=#a64d7933, title="Inner High")
- inner_low = plot(inner=="Disable" ? na : 50-inner_mult*(inner=="Dynamic" ? RSI_ch : 5.0), color=#a64d7933, title="Inner Low")
- fill(inner_high, inner_low, color=#a64d7922)
- hullma = wma(2*wma(RSI, hmalength/2)-wma(RSI, hmalength), floor(sqrt(hmalength)))
- plot(hullma, color= hullma > RSI ? color.orange : color.blue)
- // plot(RSI, color=purple,title="RSI")
Advertisement
Add Comment
Please, Sign In to add comment