Forums › ProRealTime English forum › ProBuilder support › Sessions London NewYork › Reply To: Sessions London NewYork
04/17/2025 at 9:52 PM
#246046
Hi,
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 Madrid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
// 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 Madrid DEFPARAM CALCULATEONLASTBARS = 10000 DEFPARAM DRAWONLASTBARONLY = True ONCE Tokio = 1 ONCE London = 1 ONCE NewYork = 1 ONCE LunchTime = 0 ONCE Opacity = 60 // === LONDON (LSE) (Time changes dont affect) === ONCE londonstart = 090000 ONCE londonend = 173000 ONCE londonlunchstart = 130000 ONCE londonlunchsend = 140000 // === SUMMER TIME IN SPAIN === esDomingo = dayofweek = 0 esMarzo = month = 3 esOctubre = month = 10 esNoviembre = month = 11 diaDelMes = day ultimoDiaDelMes = 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 then ONCE AsianStart = 020000 ONCE AsianEnd = 080000 ONCE AsianLunchStart = 043000 ONCE AsianLunchEnd = 053000 else ONCE AsianStart = 010000 ONCE AsianEnd = 070000 ONCE AsianLunchStart = 033000 ONCE AsianLunchEnd = 043000 endif // === OVERLAP CEST vs ET timezones (Spain vs NYSE) in march and october === // Desajuste de marzo // Segundo domingo de marzo esSegundoDomingoMarzo = esMarzo AND esDomingo AND diaDelMes >= 8 AND diaDelMes <= 14 // Último domingo de marzo esUltimoDomingoMarzo = esMarzo AND (diaDelMes >= (ultimoDiaDelMes - 6) AND diaDelMes <= ultimoDiaDelMes) AND dayofweek = 0 // Desajuste marzo: entre el segundo domingo de marzo y el último domingo de marzo desajusteMarzo = 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 = 0 esPrimerDomingoNoviembre = esNoviembre AND (diaDelMes <= 7 AND dayofweek = 0) // Desajuste octubre-noviembre: entre el último domingo de octubre y el primer domingo de noviembre desajusteOctubreNoviembre = (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 then ONCE USAStart = 143000 ONCE USAEnd = 210000 ONCE USALunchStart = 170000 ONCE USALunchEnd = 180000 else ONCE USAStart = 153000 ONCE USAEnd = 220000 ONCE USALunchStart = 180000 ONCE USALunchEnd = 190000 endif // === SOLAPAMIENTOS === // NY + Londres if NewYork AND london AND (time > USAStart AND time <= londonend) then backgroundcolor(0, 90, 255, Opacity) endif // SESIONES INDIVIDUALES (solo si no hay solapamiento) if tokio AND (time > AsianStart AND time <= AsianEnd) then backgroundcolor("red", Opacity) endif if london AND NOT (NewYork AND (time > USAStart AND time <= londonend)) then if (time > londonstart AND time <= londonend) then backgroundcolor("cyan", Opacity) endif endif if NewYork AND NOT (london AND (time > USAStart AND time <= londonend)) then if (time > USAStart AND time <= USAEnd) then backgroundcolor("blue", Opacity) endif endif // Lunch Time (Only Tokyo is official - London and NY are estimated) if LunchTime then if time > AsianLunchStart and time <= AsianLunchEnd then backgroundcolor(0, 0, 0, 0) endif if time > londonlunchstart and time <= londonlunchsend then backgroundcolor(0, 0, 0, 0) endif if time > USALunchStart and time <= USALunchEnd then backgroundcolor(0, 0, 0, 0) endif endif RETURN |
I 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.
1 2 3 |
// 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 Madrid
1 |