RicardoSantos

[RS]Session Pivot V0

160 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)

United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
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
Profile Profile Settings Account and Billing Support Priority Support Report Issue Ideas Published Followers Following Private Messages Chat Sign Out