Repository navigation
Commit 88cd0c8
fix: anchor OANDA's 1800-1700 intraday grid at the 17:00 ET day stamp
TradingView aligns the intraday request.security grid ("45", "240")
at the symbol's DAY STAMP -- the instant its daily bar starts -- and
on OANDA that instant is the 17:00 ET forex roll for every
instrument. EURUSD (1700-1700) opens on it, so its grid was already
right; XAUUSD (1800-1700) trades from one hour after it, and the
engine anchored its grid at the 18:00 ET session open
(intraday_clock_ms subtracting session_open_offset_minutes).
Pinned with `lab tv` on OANDA:XAUUSD 15, 2025-04-01..04-15
(pin-xau-grid-240 / -45 / -D: entry on ta.change(time("<tf>")),
close next bar, so every entry stamp is a boundary + 15 min):
"240": boundaries 01:00Z / 05:00Z / 09:00Z / 13:00Z / 17:00Z and
the day's first traded bar 22:00Z -- a 4h grid anchored at
21:00Z = 17:00 EDT, whose 17:00-21:00 ET bucket holds only
the 18:00-20:45 trading;
"45": boundaries 22:30Z / 23:15Z / 00:00Z / 00:45Z ... -- 21:00Z
+ k*45m (an 18:00 ET anchor puts them at 22:45Z / 23:30Z /
00:15Z);
"D": the daily bucket starts at the 17:00 ET stamp; the day's
first bar is 22:00Z.
Family evidence: all 7 TV base entries of every 3commas-* XAUUSD DCA
probe (request.security(syminfo.tickerid, "240", ta.rsi(...)) gate)
sit on the 17:00-ET 4h grid (21/01/05/09/13/17 ET) and all 7 engine
ones on an 18:00-ET grid; the 3 matched legs agree to 1e-6, so the
DCA math is exact once the grid agrees.
The rule lives in one place: session_day_stamp_offset_minutes
(src/timeframe.cpp) returns the session open for every session
except the 1800-1700 window, whose stamp is its 17:00 close -- the
same hour engine_aux_security.cpp already routes OANDA's native
daily bars by. intraday_clock_ms subtracts the stamp instead of the
open, so the request.security ratio buckets, bucket_open_ms /
bar_label_ms (the grid label, finding 473), tf_change and the
range-start bucket cut all move together. The session-day ordinal
runs on the same clock; since no 1800-1700 bar trades in the
17:00-18:00 hour the two clocks attribute differently, every D/W/M
anchor of that session is unchanged: the D bar opens 18:00 ET and
closes 17:00 ET, the week opens Sunday 18:00 ET, and OANDA's
17:00-ET-stamped daily bars still route to the session they cover
(session_covered_instant_ms now rolls a pre-open stamp forward to
its session's open, keeping its documented contract bit-for-bit).
One consequence is a fix of its own: the "D" bucket on 1800-1700
now completes on the session's last chart bar (16:45 ET, whose
close is the stamp) as it does on 1700-1700, instead of on the next
session's first bar.
Sessions whose open is the stamp keep their grid bit-for-bit: OANDA
1700-1700 (now the very grid XAUUSD uses), CME 1700-1600 CT, NYSE
0930-1600, NSE 0915-1530, 24x7 UTC. tests/test_oanda_day_stamp_grid
pins the XAUUSD "240" / "45" grids in EDT and EST, the unchanged
session-day model and D completion, and those regression grids;
compiled against the previous library its XAUUSD checks fail and
every regression pin passes.
Not touched, reported as follow-ups: time("<intraday tf>")
(session_time.cpp compute_tf_open_ms) still keys intraday tfs on the
UTC epoch grid for every symbol -- the pin strategies would expose
that separately -- and time("D") on 1800-1700 still reports the
18:00 ET session open.
ctest 153/153 (152 + the new binary, 683 checks); scripts unittest
102 OK; check_c_abi_runtime.py clean.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014vizwdJMsDkHsjmS4StvZY
Claude-Session: https://claude.ai/code/session_01BvPydDgRoDYDWrjz5JtGE11 parent 11e61d4 commit 88cd0c8
4 files changed
Lines changed: 450 additions & 10 deletions
File tree
- include/pineforge
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
221 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
222 | 259 | | |
223 | 260 | | |
224 | 261 | | |
225 | | - | |
| 262 | + | |
226 | 263 | | |
227 | 264 | | |
228 | 265 | | |
| |||
420 | 457 | | |
421 | 458 | | |
422 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
423 | 465 | | |
424 | 466 | | |
425 | 467 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
0 commit comments