Sessions London NewYork
Forums › ProRealTime English forum › ProBuilder support › Sessions London NewYork
- This topic has 4 replies, 2 voices, and was last updated 18 hours ago by
Schizophunk.
-
-
03/27/2025 at 6:58 PM #245361
Hi,
Just want to share with you an indicator to see the sessions of Londes and New York in your intraday chart. If someone has similar or want to improve it, please contribute by answering this post.
Indicador para marcar las sesiones de Londres y Nueva York en ProRealTime123456789101112131415161718192021222324252627282930// Indicador para marcar las sesiones de Londres y Nueva York en ProRealTime// Se ajusta automáticamente al horario del sistematimeLocal = BarIndex// Marcar apertura de Londres (11:00 horario local)iF Hour = 11 AND Minute = 0 THENDRAWLINE(timeLocal, Lowest[10], timeLocal, Highest[10]) COLOURED(255, 255, 0)DRAWTEXT("Londres Open", timeLocal, Highest[10] + (Highest[10] - Lowest[10]) * 0.02) COLOURED(255, 255, 0)ENDIF// Marcar cierre de Londres (17:00 horario local)iF Hour = 19 AND Minute = 30 THENDRAWLINE(timeLocal, Lowest[10], timeLocal, Highest[10]) COLOURED(255, 255, 0)DRAWTEXT("Londres Close", timeLocal, Highest[10] + (Highest[10] - Lowest[10]) * 0.02) COLOURED(255, 255, 0)ENDIF// Marcar apertura de Nueva York (16:30 horario local)iF Hour = 16 AND Minute = 30 THENDRAWLINE(timeLocal, Lowest[10], timeLocal, Highest[10]) COLOURED(0, 255, 255)DRAWTEXT("New York Open", timeLocal, Highest[10] + (Highest[10] - Lowest[10]) * 0.02) COLOURED(0, 255, 255)ENDIF// Marcar cierre de Nueva York (22:00 horario local)iF Hour = 23 AND Minute = 0 THENDRAWLINE(timeLocal, Lowest[10], timeLocal, Highest[10]) COLOURED(0, 255, 255)DRAWTEXT("New York Close", timeLocal, Highest[10] + (Highest[10] - Lowest[10]) * 0.02) COLOURED(0, 255, 255)ENDIFRETURN 003/28/2025 at 9:59 AM #245380Thank you for your contribution!
Just in case it’s useful, I’m sharing this code I published a few weeks ago: https://www.prorealcode.com/prorealtime-indicators/ict-killzones-and-pivots/2 users thanked author for this post.
03/28/2025 at 10:20 AM #245381Hi Ivan,
Amazing work. Really helpful.
Thank you,
04/17/2025 at 9:52 PM #246046Hi,
I did this indicator from the one provided by @toniyecla.
Tokio, London, and Newyork market session adjusted to summer time changes if your PRT is set up in Madrid123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122// Author: toniyecla - contact@rescommunesomnium.com// Modified: Juan Diaz Maldonado// Tokio, London, and Newyork market session adjusted to summer time changes if your PRT is set up in MadridDEFPARAM CALCULATEONLASTBARS = 10000DEFPARAM DRAWONLASTBARONLY = TrueONCE Tokio = 1ONCE London = 1ONCE NewYork = 1ONCE LunchTime = 0ONCE Opacity = 60// === LONDON (LSE) (Time changes dont affect) ===ONCE londonstart = 090000ONCE londonend = 173000ONCE londonlunchstart = 130000ONCE londonlunchsend = 140000// === SUMMER TIME IN SPAIN ===esDomingo = dayofweek = 0esMarzo = month = 3esOctubre = month = 10esNoviembre = month = 11diaDelMes = dayultimoDiaDelMes = 31// Last Sunday of March (Summer time starts)esUltimoDomingoMarzo = esDomingo AND esMarzo AND (ultimoDiaDelMes - diaDelMes) < 7// Last week of October (Summer time ends)esUltimaSemanaOctubre = (esOctubre AND esDomingo AND (diaDelMes + 4) < 31) OR (esOctubre AND dayofweek = 1 AND (diaDelMes + 3) < 31) OR (esOctubre AND dayofweek = 2 AND (diaDelMes + 2) < 31) OR (esOctubre AND dayofweek = 3 AND (diaDelMes + 1) < 31) OR (esOctubre AND dayofweek = 4 AND diaDelMes < 31) OR (esOctubre AND dayofweek = 5 AND (ultimoDiaDelMes - diaDelMes) < 7)// General condition for summer time (only affects Tokio)esHorarioVerano = esUltimoDomingoMarzo OR (month > 3 AND month < 10) OR (esOctubre AND NOT esUltimaSemanaOctubre)// === TOKYO (TSE) ===if esHorarioVerano thenONCE AsianStart = 020000ONCE AsianEnd = 080000ONCE AsianLunchStart = 043000ONCE AsianLunchEnd = 053000elseONCE AsianStart = 010000ONCE AsianEnd = 070000ONCE AsianLunchStart = 033000ONCE AsianLunchEnd = 043000endif// === OVERLAP CEST vs ET timezones (Spain vs NYSE) in march and october ===// Desajuste de marzo// Segundo domingo de marzoesSegundoDomingoMarzo = esMarzo AND esDomingo AND diaDelMes >= 8 AND diaDelMes <= 14// Último domingo de marzoesUltimoDomingoMarzo = esMarzo AND (diaDelMes >= (ultimoDiaDelMes - 6) AND diaDelMes <= ultimoDiaDelMes) AND dayofweek = 0// Desajuste marzo: entre el segundo domingo de marzo y el último domingo de marzodesajusteMarzo = esMarzo AND diaDelMes >= 8 AND diaDelMes <= ultimoDiaDelMes AND esSegundoDomingoMarzo AND NOT esUltimoDomingoMarzo// Desajuste de octubre-noviembre// Último domingo de octubre (determinamos si estamos antes del primer domingo de noviembre)esUltimoDomingoOctubre = esOctubre AND (diaDelMes >= (ultimoDiaDelMes - 6) AND diaDelMes <= ultimoDiaDelMes) AND dayofweek = 0esPrimerDomingoNoviembre = esNoviembre AND (diaDelMes <= 7 AND dayofweek = 0)// Desajuste octubre-noviembre: entre el último domingo de octubre y el primer domingo de noviembredesajusteOctubreNoviembre = (esOctubre AND diaDelMes >= 25) OR (esNoviembre AND diaDelMes <= 7)// Condición final de desajuste horario (marzo o octubre-noviembre)desajusteHorarioNYSE = (desajusteMarzo AND NOT desajusteOctubreNoviembre)//OR (NOT desajusteMarzo AND desajusteOctubreNoviembre)// === NEW YORK (NYSE) ===if desajusteHorarioNYSE thenONCE USAStart = 143000ONCE USAEnd = 210000ONCE USALunchStart = 170000ONCE USALunchEnd = 180000elseONCE USAStart = 153000ONCE USAEnd = 220000ONCE USALunchStart = 180000ONCE USALunchEnd = 190000endif// === SOLAPAMIENTOS ===// NY + Londresif NewYork AND london AND (time > USAStart AND time <= londonend) thenbackgroundcolor(0, 90, 255, Opacity)endif// SESIONES INDIVIDUALES (solo si no hay solapamiento)if tokio AND (time > AsianStart AND time <= AsianEnd) thenbackgroundcolor("red", Opacity)endifif london AND NOT (NewYork AND (time > USAStart AND time <= londonend)) thenif (time > londonstart AND time <= londonend) thenbackgroundcolor("cyan", Opacity)endifendifif NewYork AND NOT (london AND (time > USAStart AND time <= londonend)) thenif (time > USAStart AND time <= USAEnd) thenbackgroundcolor("blue", Opacity)endifendif// Lunch Time (Only Tokyo is official - London and NY are estimated)if LunchTime thenif time > AsianLunchStart and time <= AsianLunchEnd thenbackgroundcolor(0, 0, 0, 0)endifif time > londonlunchstart and time <= londonlunchsend thenbackgroundcolor(0, 0, 0, 0)endifif time > USALunchStart and time <= USALunchEnd thenbackgroundcolor(0, 0, 0, 0)endifendifRETURNI considered the time zone adjustments due to summer time changes.
However, in lines 68 to 70, when I discomment “//OR (NOT desajusteMarzo AND desajusteOctubreNoviembre)”, the first condition “desajusteHorarioNYSE = (desajusteMarzo AND NOT desajusteOctubreNoviembre) ” doesnt apply. It looks there is an overlaping but I can not find it.
123// Condición final de desajuste horario (marzo o octubre-noviembre)desajusteHorarioNYSE = (desajusteMarzo AND NOT desajusteOctubreNoviembre)//OR (NOT desajusteMarzo AND desajusteOctubreNoviembre)May someone help me directly with the code? I will appreciate also if someone gives ideas, tips, resources for codes depuration.
Thank you very much to all the comunity ProRealCode.
Tokio, London, and Newyork market session adjusted to summer time changes if your PRT is set up in Madrid104/18/2025 at 2:38 PM #246070Hi everyone,
Just wanted to share with you the debugged code. I also imporved the code structure, so it is more understable and easy to adapt to other timezones.
Hope it is helpful for some. As this forum has provided me tons of knowlegde, i just want to give back what i consider it can be helpful.
Sessions on graph (while in Spain timezone)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120DEFPARAM CALCULATEONLASTBARS = 40000DEFPARAM DRAWONLASTBARONLY = TrueONCE London = 1ONCE Tokio = 1ONCE NewYork = 1ONCE LunchTime = 0ONCE Opacity = 60// Variables-ConstantsesDomingo = (DayOfWeek = 0)esMarzo = (Month = 3)esOctubre = (Month = 10)esNoviembre = (Month = 11)diaDelMes = DayultimoDiaDelMes = 31// Summer time in spain is from last sunday march to last sunday octoberesUltimoDomingoMarzo = esMarzo AND esDomingo AND (ultimoDiaDelMes - diaDelMes) < 7esUltimoDomingoOctubre = esOctubre AND esDomingo AND (ultimoDiaDelMes - diaDelMes) < 7// Summer time in USA is from second sunday march to first sunday novemberesSegundoDomingoMarzo = esMarzo AND esDomingo AND diaDelMes >= 8 AND diaDelMes <= 14esPrimerDomingoNoviembre = esNoviembre AND diaDelMes <= 7 AND dayofweek = 0// Spain summer time detectionONCE horarioVerano = 0IF esUltimoDomingoMarzo THENhorarioVerano = 1ELSIF esUltimoDomingoOctubre thenhorarioVerano = 0ENDIF// Spain-USA march deadjustment detectionONCE desajusteMarzo = 0if esSegundoDomingoMarzo THENdesajusteMarzo = 1ELSIF esUltimoDomingoMarzo THENdesajusteMarzo = 0ENDIF// Spain-USA October-November deadjustment detectionONCE desajusteoctubre = 0if esUltimoDomingoOctubre THENdesajusteoctubre = 1ELSIF esPrimerDomingoNoviembre THENdesajusteoctubre = 0ENDIF//// Represent in chat the affected time zones where to apply adjustments//if horarioVerano = 1 THEN//BACKGROUNDCOLOR ("white", Opacity)//ENDIF//if desajusteMarzo = 1 THEN//BACKGROUNDCOLOR ("white", Opacity)//ENDIF//if desajusteoctubre = 1 THEN//BACKGROUNDCOLOR ("white", Opacity)//ENDIF// === LONDON (LSE) ===londonstart = 090000londonend = 173000londonlunchstart = 130000londonlunchsend = 140000// === TOKYO (TSE) ===IF horarioVerano = 1 THENAsianStart = 020000AsianEnd = 080000AsianLunchStart = 043000AsianLunchEnd = 053000ELSEAsianStart = 010000AsianEnd = 070000AsianLunchStart = 033000AsianLunchEnd = 043000ENDIF// === NEW YORK (NYSE) ===if desajusteMarzo = 1 OR desajusteoctubre = 1 thenUSAStart = 143000USAEnd = 210000USALunchStart = 170000USALunchEnd = 180000elseUSAStart = 153000USAEnd = 220000USALunchStart = 180000USALunchEnd = 190000endif// === SESSIONS ON CHART ===// First we will represent Londo-NewYork session overlap in a different colour. Then the restif NewYork AND London AND (time >= USAStart AND time <= londonend) thenbackgroundcolor(0, 90, 255, Opacity)elseif Tokio AND (time > AsianStart AND time <= AsianEnd) thenbackgroundcolor(255, 0, 0, Opacity)endifif London AND (time > londonstart AND time <= londonend) thenbackgroundcolor(0, 255, 255, Opacity)endifif NewYork AND (time > USAStart AND time <= USAEnd) thenbackgroundcolor(0, 0, 255, Opacity)endifendif// Lunch Time Handling. Only Japan is official, the others are estimationsif LunchTime thenif (time > AsianLunchStart and time <= AsianLunchEnd) or (time > londonlunchstart and time <= londonlunchsend) or (time > USALunchStart and time <= USALunchEnd) thenbackgroundcolor(0, 0, 0, 0)endifendifRETURNHave a nice day.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on