Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // © CryptoCurl
- //@version=5
- indicator('CC Sessions', overlay=true)
- timeinrange(res, sess) =>
- time(res, sess) != 0
- iKZNY = input(true, title='New York')
- iOpenKZLondon = input(true, title='London')
- iAsiaKZ = input(true, title='Asia')
- iClose = input(true, title='Close')
- AsiaKZ = input('0000-0559:1234567', title='Asia')
- LondonOpenKZ = input('0600-1159:1234567', title='London')
- KZNY = input('1200-1959:1234567', title='New York')
- closeKZ = input('2000-2359:1234567', title='Close')
- onlyLastperiode = input(title='show only last periode', defval=true)
- OnePeriod() =>
- timeframe.ismonthly ? 40320 * timeframe.multiplier : timeframe.isweekly ? 10080 * timeframe.multiplier : timeframe.isdaily ? 1440 * timeframe.multiplier : timeframe.multiplier
- bgOffset = 1440 / OnePeriod() == math.floor(1440 / OnePeriod()) ? 1440 / OnePeriod() : 0
- asia = time(timeframe.period, AsiaKZ)
- london = time(timeframe.period, LondonOpenKZ)
- ny = time(timeframe.period, KZNY)
- closeSession = time(timeframe.period, closeKZ)
- closeTime = request.security(syminfo.tickerid, 'D', time_close[0], lookahead=barmerge.lookahead_on)
- //closeTime is in ms; bgOffset in minutes
- paintitNot = timenow > closeTime + 24 * 60 * 1000 * 60
- bgcolor(iAsiaKZ and not na(asia) ? onlyLastperiode and paintitNot ? na : color.yellow : na, offset=bgOffset, transp=95)
- bgcolor(iAsiaKZ and not na(asia) ? onlyLastperiode and paintitNot ? na : color.yellow : na, transp=95)
- bgcolor(iOpenKZLondon and na(asia) and not na(asia[1]) ? onlyLastperiode and paintitNot ? na : color.green : na, offset=bgOffset, transp=70)
- bgcolor(iOpenKZLondon and na(asia) and not na(asia[1]) ? onlyLastperiode and paintitNot ? na : color.green : na, transp=70)
- bgcolor(iOpenKZLondon and not na(london) ? onlyLastperiode and paintitNot ? na : color.green : na, offset=bgOffset, transp=95)
- bgcolor(iOpenKZLondon and not na(london) ? onlyLastperiode and paintitNot ? na : color.green : na, transp=95)
- bgcolor(iKZNY and na(london) and not na(london[1]) ? onlyLastperiode and paintitNot ? na : color.purple : na, offset=bgOffset, transp=70)
- bgcolor(iKZNY and na(london) and not na(london[1]) ? onlyLastperiode and paintitNot ? na : color.purple : na, transp=70)
- bgcolor(iKZNY and not na(ny) ? onlyLastperiode and paintitNot ? na : color.purple : na, transp=95)
- bgcolor(iClose and na(ny) and not na(ny[1]) ? onlyLastperiode and paintitNot ? na : color.white : na, offset=bgOffset, transp=70)
- bgcolor(iClose and na(ny) and not na(ny[1]) ? onlyLastperiode and paintitNot ? na : color.white : na, transp=70)
- bgcolor(iAsiaKZ and na(closeSession) and not na(closeSession[1]) ? onlyLastperiode and paintitNot ? na : color.yellow : na, offset=bgOffset, transp=70)
- bgcolor(iAsiaKZ and na(closeSession) and not na(closeSession[1]) ? onlyLastperiode and paintitNot ? na : color.yellow : na, transp=70)
Advertisement
Add Comment
Please, Sign In to add comment