Candle Formation
Availability: this candle formation logic is implemented in JForex4 version 4.9.0 or later
Why this change matters
Moving from a single platform-wide time zone to instrument-specific trading sessions is one of the most important changes to how data is presented in JForex4. A trading day is no longer a calendar day in some global time zone. It is the day of that instrument's own market. This affects every instrument traded in JForex4:
- Daily and intraday candles. Daily candles start and end at the instrument's session boundaries. Intraday candles (from M2 up) are aligned to the session open as well, which shifts them against clock alignment when the session opens at a non-round time. M1 candles are not affected. Charts therefore match the real market hours of each instrument.
- Daily price statistics. The trading session also influences the daily price statistics of each instrument. They belong to the instrument's trading day, so they follow the session boundaries and not a calendar day or a global day start:
- Daily net and % price change. The change is measured against the previous close price, and the previous close depends on the trading session end time.
- Daily High. The highest price within the instrument's trading session.
- Daily Low. The lowest price within the instrument's trading session.
- Correct trading weeks. Forex shows exactly 5 trading days per week, with no partial Sunday candle and no artificial 6-day weeks around DST changes.
- Independent DST handling. Each instrument follows the DST rules of its own market's time zone, so US and European clock changes no longer interfere with each other.
Because the session differs per instrument, the same calendar date can cover different periods for different instruments, so daily candles and daily statistics should be compared with that in mind. The background to this change is described in Section 9.
At a glance
- Every instrument has its own trading session: an open time, a close time and a time zone.
- Candles are aligned to the session open, not to the clock and not to UTC. D1 always starts at the session open. Intraday timeframes from M2 up are shifted only when the session open is not a whole multiple of the timeframe. M1 is never affected (see section 6).
- A session that is not a whole number of timeframes long ends with a shorter final candle.
- The trading session also drives the daily price statistics of each instrument: daily net and % change (previous close depends on the session end time), Daily High and Daily Low.
- DST is handled per instrument, using the DST rules of that instrument's own time zone.
- Settlement time (position rollover) is separate from sessions: it is 17:00 ET for all instruments (see section 8).
| Instrument | Session | Time zone | Session length | D1 starts | H1 candles per day | Last H1 |
|---|---|---|---|---|---|---|
| EUR/USD | 17:00 – 17:00 | America/New_York | 24 h | 17:00 | 24 | 60 min |
| EUR/HUF | 02:00 – 17:00 | America/New_York | 15 h | 02:00 | 15 | 60 min |
| USA500.IDX | 17:00 – 15:15 | America/Chicago | 22 h 15 min | 17:00 | 23 | 15 min |
| UK100.IDX | 08:00 – 16:30 | Europe/London | 8 h 30 min | 08:00 | 9 | 30 min |
| SUGAR.CMD | 08:45 – 17:55 | Europe/London | 9 h 10 min | 08:45 | 10 | 10 min |
| COCOA.CMD | 09:15 – 17:00 | Europe/London | 7 h 45 min | 09:15 | 8 | 45 min |
| BTC/USD, ETH/USD | 00:00 – 00:00 | UTC | 24 h | 00:00 | 24 | 60 min |
The full list of sessions is on the wiki: Trading Sessions
1. Introduction
Candles are formed from each instrument's individual trading session, not from a global platform time zone.
This gives:
- Candles that match the real market hours of each instrument
- Correct DST handling per region, independent of other regions
- Daily candle boundaries aligned with actual trading days
- Always 5 trading days per week for instruments that trade Monday to Friday
- No awkward DST transition periods
2. What is a trading session?
A trading session defines three things for an instrument:
- When the market opens and closes
- Which time zone those times are expressed in
- The candle schedule: when candles open and close
2.1 Session definition format
Example for EUR/USD:
defaultTimezone "America/New_York"
MONDAY
start "17:00:00"
previousDayStart true
end "17:00:00"
previousDayEnd false
| Field | Meaning |
|---|---|
defaultTimezone |
The time zone all times in the definition are expressed in. Its DST rules apply. |
start |
Local time at which the session of that weekday opens. |
previousDayStart |
true means the session opens on the previous calendar day. |
end |
Local time at which the session of that weekday closes. |
previousDayEnd |
true means the session closes on the previous calendar day. false means it closes on the day itself. |
Reading the example: the Monday session opens at 17:00 New York time on Sunday and closes at 17:00 on Monday. Each session is named after the day it closes on, so Monday to Friday gives five trading days and no Saturday or Sunday candles.
2.2 Key points
- Sessions are instrument-specific, not universal.
- The session open determines when daily candles begin and where the intraday candle grid starts (M1 is unaffected, because session opens are always on a whole minute).
- Different instruments therefore have different candle start times.
- Partial candles form when the session length is not a multiple of the timeframe.
3. How to read session times
INSTRUMENT: Open - Close TimeZone
EUR/USD: 17:00 - 17:00 America/New_York
| Case | Meaning | Example |
|---|---|---|
| Open = Close | 24-hour session, from one boundary to the next | 17:00 – 17:00 = 24 h |
| Open < Close | Session within a single day | 08:45 – 17:55 = 9 h 10 min |
| Open > Close | Session runs overnight into the next day | 17:00 – 15:15 = 22 h 15 min |
Session duration = (Close − Open), plus 24 hours if the result is zero or negative.
4. Calculating candles per day
For a timeframe T and session duration D (both in minutes):
number of candles = ceil(D / T)
last candle length = D - (number of candles - 1) * T
If D divides evenly by T, there is no partial candle and the last candle has the full length T.
Worked examples
| Instrument | D (min) | Timeframe | Full candles | Remainder | Total | Last candle |
|---|---|---|---|---|---|---|
| EUR/USD | 1440 | H1 | 24 | 0 | 24 | 60 min |
| SUGAR.CMD | 550 | H1 | 9 | 10 | 10 | 10 min |
| SUGAR.CMD | 550 | M5 | 110 | 0 | 110 | 5 min |
| SUGAR.CMD | 550 | M15 | 36 | 10 | 37 | 10 min |
| USA500.IDX | 1335 | H1 | 22 | 15 | 23 | 15 min |
| UK100.IDX | 510 | H1 | 8 | 30 | 9 | 30 min |
| EUR/HUF | 900 | H4 | 3 | 180 | 4 | 180 min |
5. Candle formation by session type
5.1 Standard session (round-hour start): EUR/USD
Session: 17:00 – 17:00 America/New_York
Sunday 17:00 NY -> Daily candle (the "Monday" trading day) OPENS
17:00 - 18:00 H1 candle 1
18:00 - 19:00 H1 candle 2
...
16:00 - 17:00 H1 candle 24
Monday 17:00 NY -> Daily candle CLOSES, next daily candle OPENS
- Every trading day is exactly 24 hours.
- Exactly 24 H1 candles per day, all 60 minutes long.
- 5 trading days per week.
5.2 Non-round start: SUGAR.CMD
Session: 08:45 – 17:55 Europe/London (550 minutes)
| H1 candle | Start | End | Length |
|---|---|---|---|
| 1 | 08:45 | 09:45 | 60 min |
| 2 | 09:45 | 10:45 | 60 min |
| 3 | 10:45 | 11:45 | 60 min |
| 4 | 11:45 | 12:45 | 60 min |
| 5 | 12:45 | 13:45 | 60 min |
| 6 | 13:45 | 14:45 | 60 min |
| 7 | 14:45 | 15:45 | 60 min |
| 8 | 15:45 | 16:45 | 60 min |
| 9 | 16:45 | 17:45 | 60 min |
| 10 | 17:45 | 17:55 | 10 min |
- The day starts at 08:45, not at 00:00 or 08:00.
- All H1 candles start at :45.
- M5 candles start at 08:45, 08:50, 08:55, 09:00, 09:05, … (the same times as clock alignment, because 08:45 is a whole multiple of 5 minutes).
- M2, M10 and M30 candles are shifted against clock alignment, for example M30 candles start at 08:45, 09:15, 09:45, ….
- The daily candle closes at 17:55, and the next one opens at 08:45 on the next trading day.
5.3 Overnight session with an incomplete final hour: USA500.IDX
Session: 17:00 – 15:15 America/Chicago (1335 minutes = 22 h 15 min)
The session opens at 17:00 on the previous calendar day and closes at 15:15 on the trading day itself.
| H1 candle | Start | End | Length |
|---|---|---|---|
| 1 | 17:00 (previous day) | 18:00 | 60 min |
| 2 | 18:00 | 19:00 | 60 min |
| … | … | … | 60 min |
| 8 | 00:00 | 01:00 | 60 min |
| … | … | … | 60 min |
| 16 | 08:00 | 09:00 | 60 min |
| … | … | … | 60 min |
| 21 | 13:00 | 14:00 | 60 min |
| 22 | 14:00 | 15:00 | 60 min |
| 23 | 15:00 | 15:15 | 15 min |
- 23 H1 candles per day: 22 full candles plus one 15-minute candle.
- The session closes at 15:15, so the daily candle closes there.
- The next daily candle opens at 17:00 the same afternoon.
- Between 15:15 and 17:00 there are no candles.
6. Candle timestamps
Timestamps are aligned to the session open, not to clock time. Whether this changes anything for a given timeframe depends on the session open time.
A timeframe's candle grid is shifted compared with the usual clock grid (for example :00, :30 for M30) only when the session open is not a whole multiple of that timeframe. Otherwise the candles fall on the same times as clock alignment would give.
- M1 is never affected. Session opens are always on a whole minute, so M1 candles start at every minute either way.
- M2 and longer can be affected. For example, M2 candles of a session opening at 08:45 start at 08:45, 08:47, 08:49, …, while clock alignment would give 08:44, 08:46, 08:48, ….
- Daily candles always start at the session open.
Examples of M-timeframes, per session open:
| Session open | M1 | M2 | M5 | M10 | M15 | M30 | H1 | D1 |
|---|---|---|---|---|---|---|---|---|
| 17:00 (EUR/USD) | same | same | same | same | same | same | same | 17:00 |
| 08:45 (SUGAR.CMD) | same | shifted | same | shifted | same | shifted | shifted | 08:45 |
| 09:15 (COCOA.CMD) | same | shifted | same | shifted | same | shifted | shifted | 09:15 |
"same" means the candle times coincide with clock alignment. "shifted" means candles start at session-open-based times such as 08:45, 09:45, … for H1 or 08:45, 09:15, … for M30.
Candle start times for two instruments:
| Instrument | D1 | H1 | M5 |
|---|---|---|---|
| EUR/USD | 17:00 | 17:00, 18:00, … 16:00 | 17:00, 17:05, … |
| SUGAR.CMD | 08:45 | 08:45, 09:45, … 17:45 | 08:45, 08:50, 08:55, 09:00, … |
All times are in the instrument's own session time zone.
7. DST handling
Each instrument uses the DST rules of its own session time zone:
| Time zone | DST starts | DST ends |
|---|---|---|
| America/New_York, America/Chicago | 2nd Sunday of March | 1st Sunday of November |
| Europe/London | Last Sunday of March | Last Sunday of October |
| UTC | never | never |
Consequences:
- Because session times are expressed in local time, EUR/USD always opens at 17:00 New York time. In UTC terms that is 22:00 in winter and 21:00 in summer.
- A US DST change does not move the candles of London-based instruments, and a European DST change does not move US-based ones.
- Between the US and European changeovers the UTC offset between the two regions differs from normal. This lasts about 2–3 weeks in spring and about 1 week in autumn. It no longer affects candles, because each instrument follows its own zone.
- Cryptocurrencies use UTC, so they are never affected by DST.
8. Settlement time (important)
Settlement time is 17:00 ET (America/New_York) for all instruments.
Settlement time is the moment of the position rollover. It is a global procedure: it happens at the same time for every instrument, regardless of the instrument's trading session.
8.1 Sessions vs. settlement
| Trading session | Settlement time | |
|---|---|---|
| Defined | Per instrument | Globally, one time for all instruments |
| Time zone | The instrument's own (New York, Chicago, London, UTC, …) | America/New_York (ET) |
| Time | Varies (17:00, 08:45, 09:15, 02:00, …) | 17:00 ET |
| Determines | When candles open and close | When positions are rolled over |
8.2 What this means in practice
- Settlement does not move candle boundaries. Candles follow the instrument's session. Rollover follows the global 17:00 ET time.
- For instruments whose session is 17:00 – 17:00 America/New_York (such as EUR/USD), the daily candle boundary and the settlement time coincide.
- For all other instruments they differ. For example, SUGAR.CMD candles start at 08:45 London time, while its positions are still rolled over at 17:00 ET.
- Because 17:00 ET follows US DST, its UTC equivalent is 22:00 in winter and 21:00 in summer.
9. Why this approach: the evolution
| Approach 1: UTC candles | Approach 2: Global "Day Start Time Zone" | Approach 3: Instrument-specific sessions (current) | |
|---|---|---|---|
| Daily candle start | 00:00 UTC | 00:00 in one global zone (e.g. EET) | Each instrument's own session open |
| Forex week | 6 days (partial Sunday candle) | 5 days normally, artificial 6-day weeks during DST mismatch unless patched | Always 5 days |
| DST | Ignored | Needed hardcoded US DST rules inside the EET definition | Handled natively per time zone |
| Visible side effects | Wrong trading calendar | EUR/USD daily candles appearing at 23:00 EET during transition weeks | None |
| Fits all instruments | No | No | Yes |
9.1 Approach 1: UTC candles
Daily candles ran from 00:00 to 24:00 UTC for every instrument. Forex opens at 17:00 New York time (about 22:00 UTC in winter), so a partial Sunday candle appeared, giving six trading days per week on the chart.
9.2 Approach 2: global Day Start Time Zone
One time zone was chosen for all instruments (for example EET), and daily candles were built from hourly candles starting at 00:00 in that zone. For EUR/USD, 00:00 EET equals 17:00 New York, which fixed the six-day week. Its drawbacks:
- One time zone does not suit every instrument.
- US and European DST changes happen on different dates. To avoid artificial 6-day weeks, US DST rules were hardcoded into the EET definition, so during transition weeks EUR/USD daily candles showed at 23:00 EET and users asked why.
9.3 Approach 3: instrument-specific sessions (current)
Each instrument defines when it trades and in which time zone it trades. Daily candles come directly from the session boundaries, so no workarounds are needed, and a change to a time zone's DST rules is picked up automatically.
FAQ and troubleshooting
Why do the daily change, Daily High and Daily Low differ from what I expect for a calendar day? They are calculated for the instrument's trading session. The previous close used for the net and % change is the price at the session end time, and the High and Low cover only prices within the session.
Why do my H1 candles start at :45 (or :15)? The instrument's session opens at that minute, and all candles align to the session open.
Do M1 candles change with the trading session? No. Session opens are always on a whole minute, so M1 candles start at every minute exactly as before. Timeframes from M2 up can be shifted when the session open is not a whole multiple of the timeframe (see section 6).
Why is the last candle of the day shorter than the others? The session length is not a multiple of the timeframe. The final candle covers the remainder (see section 4).
Why does USA500.IDX have 23 H1 candles? The session is 22 h 15 min: 22 full hours plus a 15-minute candle.
Why don't my daily candles start at 00:00? They start at the session open of that instrument, in its own time zone.
EUR/USD and an index show different "days". Is that a bug? No. Each instrument has its own session boundaries, so daily candles and daily price statistics are not comparable across instruments by calendar date.
I see candles at an unexpected clock time after a DST change. Check which time zone the chart and the instrument are using. The session itself stays at the same local time, and only its UTC equivalent shifts.
My instrument's daily candle doesn't start at 17:00 ET. Is settlement at the wrong time? No. Settlement is always 17:00 ET for all instruments, and it is independent of the instrument's session and candle boundaries (see section 8).
Which version of JForex4 has this logic? JForex4 4.9.0 or later.
Glossary
| Term | Definition |
|---|---|
| Trading session | The open time, close time and time zone of an instrument |
| Session open | The reference point to which every candle is aligned |
| Partial candle | A candle shorter than its timeframe because the session ends before the candle is complete |
| Settlement time | 17:00 ET, the global time of the position rollover for all instruments |
| Rollover | The position rollover procedure performed at settlement time |
| DST | Daylight saving time |
| IANA time zone | Region-based time zone identifier such as America/New_York or Europe/London |