RicardoSantos

[RS]CCI Price Bands V0

Request for FXBOMBER
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[RS]CCI Price Bands V0", overlay=true)
src = input(title='Source', type=source, defval=hlc3)
ma_length = input(title='MA length', type=integer, defval=50)
cci_length = input(title='CCI length', type=integer, defval=14)
multiplier = input(title='deviation multiplier', type=float, defval=0.01)
SHOW_OBOS = input(title='Show OB/OS Levels', type=bool, defval=false)
OBOS_lvl = input(title='CCI OB/OS Level', type=integer, defval=100)
//---
ma = sma(src, ma_length)
cci = (src - ma) / (0.015 * dev(src, cci_length)) //100<>-100
capdev = (cum(stdev(src, 4)) / (n+1))*multiplier
//---
//--- Optional OB/OS levels:
OBLine = ma + (capdev*OBOS_lvl)
OSLine = ma - (capdev*OBOS_lvl)
plot(not SHOW_OBOS ? na : OBLine, color=black, style=circles)
plot(not SHOW_OBOS ? na : OSLine, color=black, style=circles)
//---

cciband = ma - (capdev*(0-cci))

plot(ma, color=black)

cci_color=cciband>ma and cciband>OBLine ? green : cciband<ma and cciband<OSLine ? maroon : gray
plot(cciband, color=cci_color, linewidth=1)


plot(cciband > OSLine and cciband < OBLine ? cciband : na, style=linebr, color=gray, linewidth=4)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out