MTF & Repainting

This page is what you are choosing when you decide how to use the global `On Bar Close?` switch. It is the page you read before flipping it in production, and it is the page to open first when a higher-timeframe line...

Written By Axiom Admin

Last updated 22 days ago

MTF & Repainting

This page is what you are choosing when you decide how to use the global On Bar Close? switch. It is the page you read before flipping it in production, and it is the page to open first when a higher-timeframe line on the chart has already surprised you.

You are not reading a disclaimer. You are reading a short instruction on a single switch that changes the shape of every line this tool draws.

What "repainting" means in this tool

"Repainting" is a word that gets thrown around loosely across trading tools. For this specific tool, the meaning is narrow and precise.

An Axiom MA slot computes its moving average inside a higher timeframe. On a 1-minute chart with Slot 03 set to 60 minutes, the slot's MA is evaluated against 60-minute bars. That creates two different notions of "now":

  • The chart bar's now β€” the currently-building 1-minute candle.

  • The slot's higher-timeframe now β€” the 60-minute bar that is currently being built out of the 1-minute ticks as they arrive.

Between a fresh 60-minute open and the next 60-minute close, the 60-minute bar is live and still forming. Its open, high, low, and close are all provisional values that will not be settled until the 60-minute bar closes. A moving average evaluated on a live HTF bar inherits that provisional character β€” its value can drift as new ticks refine the current HTF candle, and it can redraw once the HTF bar closes.

Repainting, for this tool, is that redraw. A line that appeared to move one way inside a live HTF bar, and then settles to a different value when the HTF bar closes, has repainted. The chart you were looking at five minutes ago may not match the chart you are looking at now, because the HTF bar backing the slot has now closed to a different number.

That behaviour is not a bug in Pine Script and it is not a flaw in Axiom MA. It is a real property of multi-timeframe reads. The right question is not "does this tool ever repaint?" The right question is "under which posture, and at what cost." That is what the On Bar Close? switch decides.

On Bar Close? β€” the switch, the scope, the cost

The switch lives in the PU Settings group as a single checkbox. It is a global control: one input, three slots.

On Bar Close?   [x]  (ON by default)

ON posture β€” confirmed-bar reads

Under ON, every slot reports the last confirmed higher-timeframe bar's MA value. The slot does not move on the live HTF bar. When the HTF bar closes, the slot advances one step. This is the shipped default.

What ON buys you:

  • Historical stability. A slot's line at a given chart bar does not change once drawn. When you look at a past bar in an hour, the slot's value on that bar is the same as it was at the time.

  • No live-bar drift. The slot's colour does not flicker inside a live HTF bar. What you saw during the HTF bar is what you will see after the HTF bar closes.

  • Alignment between what the chart shows and what was actually available at that moment. The slot is showing you the last confirmed value, which is the value that existed as of the last HTF close.

What ON costs you:

  • One bar of latency on the slot's timeframe. When a 60-minute bar closes, the 60-minute slot's new value becomes visible on the chart β€” not before. If your read depends on reacting to the current HTF bar as it is forming, ON is asking you to wait.

OFF posture β€” live-bar reads

Under OFF, every slot reports the live higher-timeframe bar's MA value. The slot can drift inside the HTF bar as new chart-timeframe ticks arrive, and the slot's line and colour can change before the HTF bar closes.

What OFF buys you:

  • Responsiveness. A 60-minute MA that has shifted meaningfully inside the current 60-minute bar will show that shift on the chart immediately, not after the bar closes.

  • A read that matches the shape of how you are trading, if you are trading the live bar on a faster cadence and using the HTF slot for context that should move in real time.

What OFF costs you:

  • Repaint exposure on the live HTF bar. The slot's value inside the current HTF bar is provisional. It can un-flip its trend state before the HTF bar closes. A decision based on a mid-bar colour flip can be invalidated before the HTF bar is done forming.

  • Live-bar instability until the HTF bar closes. Once the HTF bar closes, that bar's final value is settled for future reference; do not use OFF-mode historical/replay views as if they preserve every value the live HTF bar showed while it was forming.

Cost side by side

Property

On Bar Close? ON

On Bar Close? OFF

Live HTF-bar drift

No

Yes

Redraws on HTF close

No (already stepped at close)

Yes, during the live HTF bar only

Latency on HTF events

~1 HTF bar

None

Shipped default

Yes

No

Scope

Every enabled slot

Every enabled slot

Neither posture is "correct" in the abstract. Each is the correct posture for a different kind of read. What is not honest is flipping the switch without choosing it.

One switch, three slots β€” the scope you have to internalise

This is the single most important thing to take from the page.

The On Bar Close? switch is one input. It is passed into every slot's higher-timeframe computation at runtime. When you flip it:

  • Slot 01 changes posture.

  • Slot 02 changes posture.

  • Slot 03 changes posture.

Every enabled slot changes at once.

That is the Base trim's deliberate shape. If you flip OFF because a 60-minute slot is too slow for your cadence, you are also loosening the 5-minute slot and the 15-minute slot. A 5-minute slot run under OFF on a 1-minute chart is reading a live 5-minute bar; its colour can flip inside that 5-minute bar and flip back before the bar closes. A trader who flipped OFF to "loosen the 60m" and then reads a 5-minute colour flip as confirmation has walked into the trap the global scope was warning them about.

If your use case genuinely requires mixed posture β€” Slot 03 confirmed while Slot 01 runs live β€” the Base trim cannot give you that. The CTX trim's per-slot On Bar Close? input is the right tool. See Axiom MA CTX β€” MTF & Repainting for the per-slot variant. Do not try to approximate mixed posture by flipping the Base switch and choosing to "remember" that certain slots should be ignored. The blend will still read the slots you want to ignore. The alignment alerts will still count them. The tool is not lying to you under OFF; you will be lying to yourself.

Verification walkthrough β€” less than a minute on your own chart

Open a 1-minute chart of a liquid regular-session symbol with the Base defaults loaded. The point of this walk is to see the scope of the switch rather than to read about it.

  1. Confirm On Bar Close? is ON. Wait for a 5-minute bar to close. Watch Slot 01's teal line β€” it should step forward one unit when the 5-minute bar closes, then hold flat through the next 5-minute bar.

  2. Open the input dialog, flip On Bar Close? to OFF, click OK.

  3. Watch Slot 01 across the next 5-minute bar. The teal line should now move smoothly as each 1-minute candle completes, rather than holding flat. Its colour may flicker between teal and half-opacity teal within the 5-minute bar.

  4. At the same time, watch Slot 02 (blue) across a 15-minute window and Slot 03 (purple) across a 60-minute window. Both slots are now moving inside their respective HTF bars.

  5. Flip On Bar Close? back to ON. Both slots' mid-bar drift freezes; all three return to the confirmed-bar step behaviour.

You should finish the walk with a direct sensory answer to "what does one switch do across three slots." That answer is the page's load-bearing teaching. The rest is detail.

When OFF is actually the right choice

OFF is offered because some reads genuinely need it. A few shapes where flipping is deliberate rather than reflexive:

  • You are actively scalping on the chart cadence, you have a fast MA read on a near-HTF that you want to match the live shape of the HTF bar, and you have built the rest of your process around the fact that the read will drift until the HTF closes.

  • You are running a dashboard or alert-only workflow where "what the HTF is doing right now" is the useful read, and "what the HTF did at last close" is too late.

  • You have specifically decided that the cost of the latency under ON exceeds the cost of the drift under OFF for the kind of decision you are making.

A litmus test that has held up well in practice: if you cannot name out loud, in one sentence, what you are going to do with a mid-HTF-bar colour flip that you would not do with a confirmed-bar flip, you probably do not need OFF.

If you need OFF on some slots and ON on others, Base cannot give you that. Route to Axiom MA CTX.

The slot-timeframe-below-chart runtime error

This is the other behaviour this page needs to cover β€” because the guard that fires it lives in the same place in the code as the repaint posture, and because the error will show up the first time a reader sets a slot's TimeFrame: to something lower than the chart's.

Why the guard exists

Asking a moving average on the 1-minute timeframe to show up as a "higher-timeframe" slot on a 5-minute chart does not match this tool's contract. The posture semantics of On Bar Close? assume the slot timeframe is equal to or above the chart timeframe. Rather than return something that no longer fits that promise, the tool refuses the configuration and tells you which slot caused it.

What the error looks like

The tool triggers a runtime error whose message begins with the offending slot's label β€” MA 01, MA 02, or MA 03 β€” and continues ... timeframe cannot be lower than the chart timeframe. TradingView displays that message in the status area at the top of the chart, and the overlay blanks.

How to fix it

  1. Note the slot named in the error message.

  2. Open that slot's group in the inputs dialog.

  3. Raise the slot's TimeFrame: to at least the chart's timeframe. The slot can match the chart's timeframe or sit above it β€” either is valid.

  4. Click OK. The chart should return.

If you want to leave the indicator loaded on charts across many timeframes, set each slot's TimeFrame: to something greater than or equal to the lowest chart timeframe you will use. The guard triggers whenever the inequality is broken; there is no chart timeframe at which it "switches off."

Why this is intentional rather than a defect

Three reasons named out loud, because the first reaction to any runtime-error screen is usually "the tool is broken":

  • The only way to get a reliable higher-timeframe read is to have a higher timeframe. Letting a slot run "higher-timeframe semantics" on a timeframe below the chart would produce numbers that do not match what the slot claims to be doing.

  • The global On Bar Close? switch's confirmed-versus-live posture assumes the slot's timeframe is above or equal to the chart's. Outside that assumption, the posture is not meaningful.

  • Naming the offending slot in the error message is a reader-facing choice. You do not have to guess which slot holds the bad input; the message tells you.

Runtime-error teaching asset

Caption (intended figure): Screenshot of the TradingView status area at the top of the chart, red strip visible. The error text reads MA 01 timeframe cannot be lower than the chart timeframe. The overlay beneath is blank β€” no lines are rendered. An inset arrow points to the offending slot's entry in the inputs dialog, showing TimeFrame: set to "1" while the chart is on a 5-minute cadence. The caption reads: "the tool is operating as documented β€” raise the offending slot's TimeFrame: to the chart's or above and the chart returns."

Intended placement: inline in the "What the error looks like" section. If a screenshot cannot be captured at drafting time, the prose description above is sufficient; Troubleshooting carries the same surface for readers coming in from a symptom rather than from this page.

Where to go next

  • Settings β€” the full catalogue of per-slot inputs and the global repaint switch, including the Length versus Trend Length banner.

  • Alerts β€” how the chart-bar-confirmed alert gate interacts with the HTF-bar posture you are reading about here.

  • Axiom MA CTX β€” the trim where On Bar Close? lives per slot rather than per indicator.

  • Limitations & Trust Boundaries β€” what this posture is and is not entitled to promise you.