OPEN-SOURCE SCRIPT
Futures Session TWAP + Bands - CFD Charts

An anchored TWAP (time-weighted average price) with 1/2/3-sigma bands that
knows when the real market is actually open — built for CFD and cash-index
charts whose 24h quotes distort classic session averages.
What makes it original: a TWAP weighs every bar equally, so on a 24h CFD chart
the thin overnight bars count as much as the liquid session and drag the line
away from the number execution desks reference. This indicator pulls the
volume of the auto-detected futures contract and uses it as a SESSION GATE:
only bars where the future actually traded are counted. It also plots an
optional futures-volume VWAP on the same anchor, so the TWAP-vs-VWAP spread
becomes readable at a glance — that spread is the point of the pair.
How it works:
- TWAP = equal-weight average of the chart's price (hlc3 by default) over the
anchor period (session/week/month); bands from the time-weighted variance.
- Session gate (optional, on by default): bars without futures volume are
skipped, so the TWAP covers the real trading session. Only session/volume
information is borrowed from the future — the price stays this chart's
price, so the futures-vs-cash basis cannot distort the level.
- The futures contract is auto-detected from the chart symbol (DAX/GER40 ->
FDAX, NAS100 -> NQ, US30 -> YM, UK100 -> Z, US500 -> ES), or set manually.
- Optional "Daily anchor = futures trading day" resets at the futures day
change instead of CFD broker midnight, matching the sibling VWAP tool.
- A status label shows the active source, the gate state and the current
VWAP-minus-TWAP spread.
How to use it: the TWAP is the fair time-average of the session — the line an
evenly-sliced execution would achieve. Compare it with the futures-volume
VWAP: VWAP above TWAP means volume was concentrated above the time average
(participants paid up), VWAP below TWAP means volume traded below it. The two
lines glued together signals balanced rotation; a widening spread marks
one-sided participation. The 2/3-sigma bands frame statistically stretched
zones relative to the session mean. Check the status label once after loading
to confirm the futures feed is active.
*This script is part of a consistent set of open-source session, range and
volume tools — the companions are on my profile.*
knows when the real market is actually open — built for CFD and cash-index
charts whose 24h quotes distort classic session averages.
What makes it original: a TWAP weighs every bar equally, so on a 24h CFD chart
the thin overnight bars count as much as the liquid session and drag the line
away from the number execution desks reference. This indicator pulls the
volume of the auto-detected futures contract and uses it as a SESSION GATE:
only bars where the future actually traded are counted. It also plots an
optional futures-volume VWAP on the same anchor, so the TWAP-vs-VWAP spread
becomes readable at a glance — that spread is the point of the pair.
How it works:
- TWAP = equal-weight average of the chart's price (hlc3 by default) over the
anchor period (session/week/month); bands from the time-weighted variance.
- Session gate (optional, on by default): bars without futures volume are
skipped, so the TWAP covers the real trading session. Only session/volume
information is borrowed from the future — the price stays this chart's
price, so the futures-vs-cash basis cannot distort the level.
- The futures contract is auto-detected from the chart symbol (DAX/GER40 ->
FDAX, NAS100 -> NQ, US30 -> YM, UK100 -> Z, US500 -> ES), or set manually.
- Optional "Daily anchor = futures trading day" resets at the futures day
change instead of CFD broker midnight, matching the sibling VWAP tool.
- A status label shows the active source, the gate state and the current
VWAP-minus-TWAP spread.
How to use it: the TWAP is the fair time-average of the session — the line an
evenly-sliced execution would achieve. Compare it with the futures-volume
VWAP: VWAP above TWAP means volume was concentrated above the time average
(participants paid up), VWAP below TWAP means volume traded below it. The two
lines glued together signals balanced rotation; a widening spread marks
one-sided participation. The 2/3-sigma bands frame statistically stretched
zones relative to the session mean. Check the status label once after loading
to confirm the futures feed is active.
*This script is part of a consistent set of open-source session, range and
volume tools — the companions are on my profile.*
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.