Trading sessions
All indicators

LibraryTime

Indicator

Trading sessions

Which of the four FX centres is open on each bar, whether London and New York overlap, and the high and low of the session you follow, so far and of the last one.

TimeOn the price2 inputsSessions

How it is calculated

Each centre is open while the bar's start time on its own clock, daylight saving included, is in its hours: Sydney 07:00 to 16:00, Tokyo 09:00 to 18:00, London and New York 08:00 to 17:00, open included, close excluded, on a local Monday to Friday unless Days says every day. The followed session's high and low run from its first bar; when it ends they become the previous high and low. Minutes count from the open to the bar's start.

Reference: FX session hours on each city's clock: Sydney 07 to 16, Tokyo 09 to 18, London and New York 08 to 17

How to read it

The flags are 1 while open and 0 otherwise, on every bar. London and New York change their clocks on different Sundays, so in those weeks the overlap is an hour longer in UTC, which the local clocks get right. A bar counts by its start time, so use H1 or finer. Holidays are not known, and a session the data starts inside counts from its first bar.

In a strategy

A London breakout: with s = ctx.ind("sessions", session="london"), go long while s.overlap is 1 and the close breaks above s.prev_high, short below s.prev_low, or only trade while s.in_session is 1.

Inputs

InputTypeDefaultRange or choices
SessionsessionChoice"london"London, New York, Tokyo, Sydney
DaysdaysChoice"mon_fri"Monday to Friday, Every day

What it draws

LineDrawn as
Session highSteps
Session lowSteps
Previous highSteps
Previous lowSteps

Used in

No strategy template reads it yet.

OrionQuant