RicardoSantos

[RS]Session Pivot V0

157 0 16
request for Robski.
Pivots starting at 8am gmt            
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]Session Pivot V0', shorttitle='SP', overlay=true)
session_time = input(title='Session time:', type=string, defval='0300-1500')
isinsession = not na(time('1', session_time))
isnewsession = change(isinsession)>0

session_open = isnewsession ? open : session_open[1]
session_high = na(session_high[1]) ? high :isnewsession ? high : high >= session_high[1] ? high : session_high[1]
session_low = na(session_low[1]) ? low :isnewsession ? low : low <= session_low[1] ? low : session_low[1]

//plot(session_open, color=gray)
//plot(session_high, color=gray)
//plot(session_low, color=gray)

P = isnewsession ? (session_high[1] + session_low[1] + session_open) / 3 : P[1]
S1 = isnewsession ? (P * 2) - session_high[1] : S1[1]
S2 = isnewsession ? P - (session_high[1]-session_low[1]) : S2[1]
R1 = isnewsession ? (P * 2) - session_low[1] : R1[1]
R2 = isnewsession ? P + (session_high[1]-session_low[1]) : R2[1]

plot(title='P', series=P, color=isnewsession?na:black)
plot(title='S1', series=S1, color=isnewsession?na:black)
plot(title='S2', series=S2, color=isnewsession?na:black)
plot(title='R1', series=R1, color=isnewsession?na:black)
plot(title='R2', series=R2, color=isnewsession?na:black)

Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
日本
한국
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