# RP analysis

30 0
updated
```study("RP analysis", overlay=true)
bars = input(type=integer, defval=500)

topen = security(tickerid, 'D', open)
thigh = security(tickerid, 'D', high)
tlow = security(tickerid, 'D', low)
tclose = security(tickerid, 'D', close)
yopen = security(tickerid, 'D', open[1])
yhigh = security(tickerid, 'D', high[1])
ylow = security(tickerid, 'D', low[1])
yclose = security(tickerid, 'D', close[1])

avgbody = security(tickerid, 'D', sum(open-close>0?open-close:close-open, bars)/bars)
avgtopwick = security(tickerid, 'D',  sum(open>close?high-open:high-close, bars)/bars )
avgbottomwick = security(tickerid, 'D',  sum(open>close?close-low:open-low, bars)/bars )

avgoverema = security(tickerid, 'D', sum(high>ema(close, 13)?high-ema(close, 13):na, bars)/bars)
avgunderema = security(tickerid, 'D', sum(ema(close, 13)>low?ema(close, 13)-low:na, bars)/bars)
highestema = highest(security(tickerid, 'D', high-ema(close, 13)), bars)
lowestema = highest(security(tickerid, 'D', ema(close, 13)-low), bars)

todayema = security(tickerid, 'D', ema(close, 13))
vwap1 = plot(vwap, title="vwap",style=line, color=blue, linewidth=4)

////// PLOTS
plotopen = plot(topen, title="Open",style=line, color=green, linewidth=4)
sma100 = plot(sma(close, 100), title="SMA100",style=line, color=red, linewidth=4)
sma500 = plot(sma(close, 500), title="SMA 500",style=line, color=gray, linewidth=4)

plotema = plot(todayema, title="EMA",style=line, color=red, linewidth=4)
topema = plot(todayema+avgoverema, title="EMA Top",style=line, color=aqua, linewidth=4)
bottomema = plot(todayema-avgunderema, title="EMA Bottom",style=line, color=aqua, linewidth=4)
plothighestema = plot(todayema+highestema, title="b",style=line, color=aqua, linewidth=4)
plotlowestema = plot(todayema-lowestema, title="b",style=line, color=aqua, linewidth=4)

wickzonetop = plot(topen+avgtopwick, title="Top Wickzone",style=line, color=blue, linewidth=4)
wickzonebottom = plot(topen-avgbottomwick, title="Bottom Wickzone",style=line, color=blue, linewidth=4)
fill(plotopen, wickzonetop, color=silver, transp=75)
fill(plotopen, wickzonebottom, color=silver, transp=75)

plotbodytop = plot(topen+avgbody, title="Top Close",style=line, color=black, linewidth=4)
plottopwick = plot(topen+avgbody+avgtopwick, title="Top Limit",style=line, color=purple, linewidth=4)
fill(wickzonetop, plotbodytop, color=black, transp=75)
fill(plotbodytop, plottopwick, color=red, transp=75)

plotbodybottom = plot(topen-avgbody, title="Bottom Close",style=line, color=black, linewidth=4)
plotbottomwick = plot(topen-avgbody-avgbottomwick, title="Bottom Limit",style=line, color=purple, linewidth=4)
fill(wickzonebottom, plotbodybottom, color=black, transp=75)
fill(plotbodybottom, plotbottomwick, color=red, transp=75)

```
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter