MTF & Repainting

The most common failure on an MA-based oscillator is not a computation bug. It is a reader who looks at a line on a live chart, assumes it was computed the way a closed-bar line is computed, and is surprised when yest...

Written By Axiom Admin

Last updated 22 days ago

MTF & Repainting

The most common failure on an MA-based oscillator is not a computation bug. It is a reader who looks at a line on a live chart, assumes it was computed the way a closed-bar line is computed, and is surprised when yesterday's line looks different from the one they remember reading at the time. That is the entire shape of the "this tool repaints on me" complaint, and it is usually produced by a setting the reader turned off without realizing what the setting was doing.

This page is the reason that does not have to happen to you on this tool. Read it before you change any slot's On Bar Close? setting. The switch is honest; what makes it dangerous is reading a result without remembering you flipped it.

The repaint switch, named plainly

Every slot in the CTX trim exposes a Power User input called On Bar Close?. It is a boolean. It defaults to ON. What it controls is when the slot reads its higher-timeframe value:

  • ON. The slot waits for the higher-timeframe bar to close before it reads a value. The value reported on the chart is stable once written. If you scroll back tomorrow, the value you see on a bar will be the same value you saw when that bar was current. This is the honest read.

  • OFF. The slot reports the live higher-timeframe bar's current value on every chart bar. The value can move as the higher-timeframe bar evolves. When the higher-timeframe bar closes, the value locks. Until it locks, the pane is showing you something that was true a moment ago but may not be true a moment from now. This is the repainting read.

That is the whole switch. One slot at a time. There is no global override.

Why the switch exists

Because there is a legitimate tradeoff between the two postures. Confirmed reads are late β€” sometimes meaningfully late, because you are waiting for a 1H or 4H bar to close. Live reads are early, but they can move out from under you. Neither is universally correct. The switch exists because the right choice depends on how you are using the specific slot.

  • A slot whose job is to provide trend context from a higher timeframe usually belongs ON. You want the context to be stable so you can read the chart underneath it with confidence.

  • A slot whose job is to react quickly to a large higher-timeframe move in progress may belong OFF, with the understanding that the reading you see during the bar is provisional. If you alert off that slot, the alert only fires on closed bars regardless of the switch β€” see Alerts β€” but the visual behavior during the bar is live.

  • A slot that you are watching for sensitivity tuning should start ON so you can audit the behavior on confirmed history. Turning it OFF during tuning is a recipe for confusing your own measurements.

"OFF is faster" is true. "OFF is better" is not. There is no free speed on a higher-timeframe read.

The slot-timeframe-versus-chart-timeframe rule

A slot's timeframe must be greater than or equal to the chart timeframe. If you configure a slot at 5m on a 1H chart, the script does not draw a 5m reading on the 1H chart, and it does not quietly convert the slot into a 1H read. It stops with a named runtime error that points to the offending slot. Equal timeframes are allowed, but equal means chart-timeframe context, not higher-timeframe context.

Consequences of this rule:

  • If you use the shipped three-slot defaults (5m, 15m, 1H) on a chart that is already at 1H, slots 01 and 02 are invalid because their timeframes are below the chart timeframe. The script raises the error instead of letting you mistake them for valid MTF context. Slot 03 is equal to the chart timeframe, so it can compute, but it is not a higher-timeframe read.

  • The safe posture is to configure slot timeframes relative to your usual chart timeframe, not as absolute numbers you never revisit. If you trade on 5m, slots at 15m, 1H, and 4H are real MTF context. If you trade on 1H, slots at 4H, 1D, and 1W are. Changing the chart to a higher timeframe without re-checking your slot stack is how a valid setup becomes invalid.

  • The runtime error is the warning. Read your own configuration rather than trusting that a saved stack will make sense on every chart timeframe.

Intrabar behavior in plain terms

When a higher-timeframe slot is ON:

  • The slot value does not change during the higher-timeframe bar.

  • It may still change per chart bar in the sense that the previous value can be read differently depending on chart bar timing, but the reported slot value for a given confirmed higher-timeframe period is stable once that period closes.

  • You can trust the historical shape of the slot line.

When a higher-timeframe slot is OFF:

  • The slot value updates on every chart bar using whatever the higher-timeframe bar's provisional state is right now.

  • If you scroll back to a higher-timeframe bar that was forming when you were watching it, the historical line in the current chart is drawn from the locked (closed) value, not the provisional values you saw at the time. The live history you remember watching is not the history you will see after the bar closes. This is normal β€” it is also the entire shape of the "this tool repaints" complaint that people bring to MA oscillators.

This script does not hide the behavior. The On Bar Close? control is named and defaults to ON. If you turn it OFF on a slot, the repaint is your choice, which is a different thing from a silent default.

A verification you can run in five minutes

Do this on a live 1m chart. Use an instrument with an active session.

  1. Open the indicator with defaults.

  2. Note the slot 01 line (5m by default, ON by default). Find a spot on the current 5m bar β€” somewhere in the middle of the bar forming right now. Write down the slot 01 value.

  3. Watch the pane for the next minute or two while the 5m bar is still forming. The slot 01 value does not change per chart bar. It changes only when the 5m bar closes.

  4. Open the slot 01 Power User block. Flip On Bar Close? to OFF. Do not change anything else.

  5. Watch the slot 01 value again. It now moves every time a chart bar ticks, reflecting the live state of the 5m bar in progress.

  6. Flip the setting back to ON. The slot returns to confirmed behavior.

You just ran the only verification that matters here. You have watched the repaint posture in action, and you have taught yourself what the switch is doing in language nothing on the chart can lie about.

Session handling and session edges

The oscillator does not do anything special at session boundaries. On instruments that trade extended hours, the pane will produce readings through the overnight session. On instruments with a closed session, the first bars after the open may read unusually because ATR carries volatility from the closed period into the open and the baseline MA may be computing on sparse pre-open data.

  • If you trade only the regular session and your chart shows extended-hours data, slots that use a session-sensitive source may produce readings across the overnight in a way that feels noisy.

  • The first ten to twenty bars after a session open can move the pane more than the price action alone would suggest. This is the scale readjusting, not a tool malfunction.

There is no masking for session state in this script. If your workflow requires it, either adjust your chart to exclude extended hours or be aware of the behavior when you read the pane at session edges.

Cross-asset slots and repaint

When a slot has an Optional Ticker set, the repaint posture applies to that ticker's higher-timeframe bar β€” not the chart's. The same rules apply:

  • ON waits for the ticker's higher-timeframe bar to close.

  • OFF uses the ticker's live higher-timeframe bar.

A cross-asset slot on a thin ticker can behave very differently from the chart instrument at the same moment, especially during the minutes when the ticker has not printed and the chart instrument has. This is not a bug. It is the honest report of a ticker that is not actively trading.

The posture this pack recommends for new readers

Until you have a specific reason otherwise:

  • Leave every slot's On Bar Close? ON.

  • Configure slot timeframes so each one is meaningfully above your chart timeframe.

  • If you flip a slot OFF, write down why, on paper or in your own notes. If you cannot name the reason, flip it back.

Where to go next