RP analysis updated 06302015

37 0 2
RP             analysis updated 06302015
Remove from Favorite Scripts Add to Favorite Scripts
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):nz(na), bars)/bars)
avgunderema = security(tickerid, 'D', sum(ema(close, 13)>low?ema(close, 13)-low:nz(na), bars)/bars)
highestema = highest(security(tickerid, 'D', high-ema(close, 13)>0?high-ema(close, 13):nz(na)), bars)
lowestema = highest(security(tickerid, 'D', ema(close, 13)-low>0?ema(close, 13)-low:nz(na)), 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="EMA Highest",style=line, color=aqua, linewidth=4)
plotlowestema = plot(todayema-lowestema, title="EMA Lowest",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)

United States
United Kingdom
Home Stock Screener Forex Signal Finder 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 Account and Billing Sign Out