Sessions on Chart
Forums › ProRealTime English forum › ProBuilder support › Sessions on Chart
- This topic has 1 reply, 2 voices, and was last updated 5 years ago by
robertogozzi.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
05/02/2020 at 6:55 PM #129483
Hi, I was looking for an indicator that visualize the London and US session (open/ close times) with a vertical color zone. I found exactly what I was looking for on Tradingview. https://www.tradingview.com/script/nY823NXq-Sessions-on-Chart/
Is there anybody with enough technical knowledge to translate this indicator to a PRT (V11) version?
The included code below is the tradingview code!
Sessions on Chart (Tradingview)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162//@version=4study("Sessions", overlay=true)bgColor = input(title="Activate High/Low View", type=input.bool, defval=false)LondonColor = color.greenNYColor = color.redAsiaColor = color.yellowSydneyColor = color.navy///Sessionsres = input(title="Resolution", type=input.resolution, defval="D", options=["D","W","M"])london = input(title="London Session", type=input.session, defval="0300-1200")ny = input(title="New York Session", type=input.session, defval="0800-1700")tokyo = input(title="Tokyo Session", type=input.session, defval="2000-0215")sydney = input(title="Sydney Session", type=input.session, defval="1700-0200")//Barsis_newbar(sess) =>t = time(res, sess)na(t[1]) and not na(t) or t[1] < tis_session(sess) =>not na(time(timeframe.period, sess))//LondonLondon = input(title="London Session", type=input.bool, defval=true)londonNewbar = is_newbar(london)londonSession = is_session(london)float londonLow = nalondonLow := if londonSessionif londonNewbarlowelsemin(londonLow[1],low)elselondonLow[1]float londonHigh = nalondonHigh := if londonSessionif londonNewbarhighelsemax(londonHigh[1],high)elselondonHigh[1]plotLL = plot(londonLow, transp = 100)plotLH = plot(londonHigh, transp = 100)fill(plotLL, plotLH, color = londonSession and London and bgColor ? LondonColor : na)bgcolor(londonSession and London and not bgColor ? LondonColor : na)//New YorkNY = input(title="New York Session", type=input.bool, defval=true)nyNewbar = is_newbar(ny)nySession = is_session(ny)float nyLow = nanyLow := if nySessionif nyNewbarlowelsemin(nyLow[1],low)elsenyLow[1]float nyHigh = nanyHigh := if nySessionif nyNewbarhighelsemax(nyHigh[1],high)elsenyHigh[1]plotNYL = plot(nyLow, transp = 100)plotNYH = plot(nyHigh, transp = 100)fill(plotNYL, plotNYH, color = nySession and NY and bgColor ? color.red : na)bgcolor(nySession and NY and not bgColor ? NYColor : na)//TokyoTokyo = input(title="Tokyo Session", type=input.bool, defval=true)tokyoNewbar = is_newbar(tokyo)tokyoSession = is_session(tokyo)float tokyoLow = natokyoLow := if tokyoSessionif tokyoNewbarlowelsemin(tokyoLow[1],low)elsetokyoLow[1]float tokyoHigh = natokyoHigh := if tokyoSessionif tokyoNewbarhighelsemax(tokyoHigh[1],high)elsetokyoHigh[1]plotTL = plot(tokyoLow, transp = 100)plotTH = plot(tokyoHigh, transp = 100)fill(plotTL, plotTH, color = tokyoSession and Tokyo and bgColor ? color.yellow : na)bgcolor(tokyoSession and Tokyo and not bgColor ? AsiaColor : na)//TokyoSydney = input(title="Sydney Session", type=input.bool, defval=false)sydneyNewbar = is_newbar(sydney)sydneySession = is_session(sydney)float sydneyLow = nasydneyLow := if sydneySessionif sydneyNewbarlowelsemin(sydneyLow[1],low)elsesydneyLow[1]float sydneyHigh = nasydneyHigh := if sydneySessionif sydneyNewbarhighelsemax(sydneyHigh[1],high)elsesydneyHigh[1]plotSL = plot(sydneyLow, transp = 100)plotSH = plot(sydneyHigh, transp = 100)fill(plotSL, plotSH, color = sydneySession and Sydney and bgColor ? color.navy : na)bgcolor(sydneySession and Sydney and not bgColor ? SydneyColor : na)05/02/2020 at 7:06 PM #129485I wrote this code for the Asian session, but it can easily modified to accomodate other sessions.
You can remove the part where the highest high and lowest low are detected and plotted.
https://www.prorealcode.com/reply/66423/
2 users thanked author for this post.
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: