MTF & Repainting

This page is a focused treatment of how the oscillator handles multi-timeframe data requests, what the On Bar Close setting actually controls, and how to verify repainting behavior yourself. If On Bar Close and repain...

Written By Axiom Admin

Last updated About 1 month ago

MTF and Repainting

This page is a focused treatment of how the oscillator handles multi-timeframe data requests, what the On Bar Close setting actually controls, and how to verify repainting behavior yourself. If On Bar Close and repainting are not concepts you think about, you can safely skip this page β€” the defaults protect you. If you plan to change On Bar Close on any slot, or if you want to understand exactly why the 1h slot updates slowly on a 5m chart, read this before making changes.


What "multi-timeframe" means in practice

Each slot can target a timeframe at or above the chart timeframe. When the slot timeframe is higher than the chart (e.g., a 1h slot on a 5m chart), the indicator needs to fetch data from that higher timeframe and map it onto the chart's bar-by-bar timeline. TradingView provides a mechanism for this β€” request.security() β€” and how that mechanism is configured determines whether the historical values you see on the chart match what was actually visible live.

The slot timeframe must be equal to or greater than the chart timeframe. Setting it lower produces a runtime error. This is a safety rail: requesting data at a resolution finer than the chart cannot provide meaningful results.


How On Bar Close works

On Bar Close is a per-slot setting. It is ON by default for every slot. What it controls is whether the slot reports the last completed (confirmed) higher-timeframe bar's values or the current (still-building) bar's values.

When ON: The indicator uses lookahead_on with a one-bar offset. This combination means: look ahead to get the current bar's value (which TradingView provides via lookahead), but then offset by one bar to retrieve the previous bar's confirmed value instead. The result is that the slot always displays the last completed HTF bar's CVD and Signal. It does not update until the next HTF bar closes.

When OFF: The indicator uses the same lookahead_on but without the offset. It retrieves the current HTF bar's values as they build in real time. The slot updates every chart bar as the HTF bar accumulates data.

The difference is not about accuracy β€” both modes compute CVD the same way. The difference is about temporal honesty: whether the values on past bars represent what was actually known at the time, or what was known after the bar finished.


The repainting truth table

On Bar Close

Slot TF vs. Chart TF

Repaints?

What the user sees

ON

Slot TF = Chart TF

No

Values update once per bar close. Historical values are stable.

ON

Slot TF > Chart TF

No

Values update only when the HTF bar closes. The slot line "steps" at HTF bar boundaries. Historical values are stable.

OFF

Slot TF = Chart TF

Effectively no

The chart timeframe bar is confirmed by the chart itself, so there is no higher-TF lag to introduce repainting. Values update each bar close.

OFF

Slot TF > Chart TF

Yes

Values update every chart bar as the HTF bar builds. The most recent reading may change when the HTF bar closes. Historical bars show the final state, not the intrabar state.

The only configuration that repaints is On Bar Close OFF with the slot timeframe higher than the chart timeframe. This is by design, not by accident. The setting is named explicitly, the default protects against it, and the behavior is documented here so you can make the tradeoff with open eyes.


What repainting looks like in practice

Imagine you are on a 5m chart with a 1h slot and On Bar Close OFF.

What happens live: Every 5-minute bar, the 1h slot recalculates its CVD and Signal using the partially complete hourly bar's data. As the hour progresses, each new 5-minute bar adds more information, and the hourly CVD estimate shifts. At minute 10, the hourly slot might read +40. At minute 30, with more data, it might read +25. At minute 55, it reads +35. When the hourly bar closes, the final confirmed value is +32.

What the chart shows after the fact: Every 5-minute bar within that hour displays +32 β€” the final value. The intrabar journey from +40 to +25 to +35 to +32 is gone. The chart makes it look like the oscillator knew the answer all along.

The danger: If you scroll back and study how the oscillator "predicted" or "caught" a move, you may be looking at the final value, not the value that was visible when the move was happening. Decisions made in real time would have been based on the shifting intrabar values, which are no longer visible. The chart rewrites your memory of what you saw. Every review of a session where On Bar Close was off is a review of a chart that did not exist during the session.


Why someone would turn On Bar Close off

The confirmed mode introduces a one-bar lag on higher-timeframe slots. On a 5m chart with a 1h slot, that lag means you are always looking at the previous hour's confirmed reading. The current hour's developing pressure is invisible until the bar closes.

Some traders prefer to see the developing reading and accept the tradeoff. They know the value may change β€” they just want the fastest available read and plan to verify it after the bar closes. This is a legitimate choice, and there are genuinely useful reasons for it: monitoring a developing 4h reading on a 5m chart during an active session, for instance, when you want to see the direction of the building bar and plan to check whether it confirms after the 4h close. The setting becomes dangerous when the user forgets (or never learned) that the historical chart no longer matches the live experience β€” and especially when they review past sessions without remembering which slots were set to live mode.

In the Pro variant, On Bar Close is per-slot. You can run your short-TF slots with On Bar Close ON (where the lag is minimal β€” a 5m slot on a 5m chart has no meaningful lag) and your long-TF observation slots with On Bar Close OFF if you want to watch the developing hourly or 4h reading. Just know what you are trading off for each slot.


Lower TF Precision and its role

Lower TF Precision is a separate data request from the slot timeframe request. It controls the sub-bar resolution used by the participation model.

For each bar at the slot timeframe, the indicator makes a secondary request for OHLCV arrays at the Lower TF Precision resolution. These sub-bars are what the participation model classifies β€” body direction, close location, wick rejection β€” to build the delta estimate for that HTF bar.

Lower TF Precision does not affect repainting behavior. Repainting is determined solely by the slot's On Bar Close setting and the relationship between the slot timeframe and the chart timeframe. Lower TF Precision affects the granularity of the delta estimate within each bar, not the timing of when that estimate becomes visible.

Constraint: Lower TF Precision must be strictly below the slot timeframe. Setting it equal or higher produces a runtime error.

Fallback: When intrabar data is unavailable, the indicator falls back to a single-bar estimate using the slot timeframe's OHLC. This fallback is silent β€” there is no warning or visual indicator.


How to verify repainting behavior yourself

These steps let you see the difference with your own eyes.

Verification 1: Confirmed vs. live on an HTF slot

  1. Open a 5m chart with the indicator loaded.

  2. Find Slot 03 (default: 1h timeframe) in the settings panel.

  3. Confirm On Bar Close is ON. Watch the 1h slot line. It should "step" β€” holding flat for 12 chart bars (one hour's worth of 5m bars) and then jumping to a new value when the hourly bar closes.

  4. Turn On Bar Close OFF for Slot 03. The 1h slot line should now update every 5-minute bar, moving more continuously.

  5. Watch through the close of an hourly bar with On Bar Close OFF. Note the reading at minute 50 of the hour. Then note the reading after the hourly bar closes. If they differ, you have observed the repainting: the confirmed value replaced the intrabar estimate.

  6. Turn On Bar Close back ON. The slot reverts to confirmed behavior.

Verification 2: Historical stability

  1. With On Bar Close ON for all slots, let the indicator run for several hours.

  2. Scroll back to a completed hourly bar's boundary. Note the 1h slot's reading on the bars within that hour.

  3. Refresh the chart or change timeframes and come back. The values should be identical β€” confirmed values do not change after the fact.

  4. Now turn On Bar Close OFF on the 1h slot and repeat the same test. On the most recent hourly bar (before it closes), you may see the values shift between chart refreshes as the intrabar estimate updates.

Verification 3: Session vs. Rolling interaction with On Bar Close

  1. Set Slot 01 to Session mode with On Bar Close ON.

  2. Set Slot 02 to Rolling mode with On Bar Close ON on the same timeframe.

  3. Both should show confirmed, non-repainting behavior β€” but their values will differ because Session resets at the window boundary and Rolling does not.

  4. Turning On Bar Close OFF on either one introduces repainting for that slot independently, without affecting the other.


The safety rails

The indicator enforces three hard constraints at runtime. Violating any of them produces a runtime error and the indicator will not load.

Constraint

What triggers the error

Why the constraint exists

Slot TF >= Chart TF

Setting the slot timeframe lower than the chart timeframe

Requesting data at a resolution finer than the chart cannot produce meaningful results

Lower TF Precision < Slot TF

Setting Lower TF Precision equal to or higher than the slot timeframe

The sub-bar request must be at a finer resolution than the bar it is subdividing

Window >= Slot TF

Setting the Window to a period shorter than the slot timeframe

The accumulation window must span at least one slot bar

These are not bugs. They prevent configurations that would produce nonsensical or misleading output. See Troubleshooting if you have hit one of these errors.