OPEN-SOURCE SCRIPT
更新済

Moving Average MTF

433
**Moving Average MTF (Multi-Timeframe)**

This indicator plots three fully customizable moving averages, each calculated from an independent timeframe of your choice. Instead of being limited to the timeframe of your chart, each MA pulls data directly from its assigned timeframe — giving you a layered view of trend across multiple time horizons simultaneously.

By default the three MAs are set to 15 minutes, 1 hour, and 4 hours, all using a 50-period SMA. This makes the indicator best suited for use on a 5-minute chart, where all three timeframes sit above your chart and give you a clear short, medium, and macro trend stack in a single view.

---

**Settings**

Each of the three MAs has its own independent group of controls:

- **Show MA** — Toggles the MA line on or off without removing it from the settings.
- **Show Label** — Toggles the end-of-line label that appears to the right of the last candle. The label displays the MA type, length, timeframe, and current value.
- **Length** — The number of candles used to calculate the MA, based on its assigned timeframe. Default is 50 for all three.
- **Timeframe** — The timeframe the MA is calculated from, regardless of what timeframe your chart is on. You can type any valid timeframe directly into this field.
- **Type** — The moving average algorithm. Choose from SMA, EMA, WMA, VWMA, RMA, or HMA.
- **Line Style** — Choose between Solid, Stepline, or Circles.
- **Line Thickness** — Controls the width of the line from 1 to 10.
- **Color** — Full color picker to set each MA to any color you prefer.

---

**How to Use**

Keep your chart timeframe at or below the lowest MA timeframe you have set. With the defaults of 15min, 1h, and 4h, running the indicator on a 5-minute chart gives you the most meaningful read. When all three MAs are stacked and sloping in the same direction, trend is aligned across all three timeframes — the highest conviction environment for a trade. When they are tangled or conflicting, the market is in an indecisive state and it is generally best to wait for clarity.

---

**Important Note**

If your chart timeframe is higher than any of the MA timeframes you have set, that MA will still display but the value will not be meaningful. The indicator will not produce errors — it is purely a logical consideration. Always ensure your chart timeframe sits below your lowest MA timeframe for accurate results.
リリースノート
**Moving Average MTF — Update Notes**

Previously, the labels on the chart were displaying timeframes as raw numbers — so instead of seeing something clean like "1h" or "4h", you'd see "60" or "240". This update fixes that by teaching the indicator how to translate those numbers into proper human-readable time labels. Minutes show as "15m", hours show as "1h", "2h", "4h", and so on, and higher timeframes like daily, weekly, and monthly display correctly as well. The chart labels are now consistent and intuitive regardless of which timeframe you configure each moving average to use.
リリースノート
## **Moving Average MTF Indicator – Update Change Log**

These updates were designed to improve the **overall experience of using the indicator**, rather than changing the way the moving averages themselves work. The calculations, timeframes, and plotting logic remain the same. The focus was on making the indicator cleaner, more efficient, and more reliable during everyday use.

---

### **Cleaner and Simpler Settings**

One of the first improvements was streamlining the indicator's settings panel.

Previously, the moving averages could be customized from both the **Inputs** tab and the **Style** tab. This created duplicate controls for colors, line thickness, and visibility. While everything still worked, it made the settings more cluttered and could lead to confusion about which controls should actually be used.

Now, all customization is handled exclusively through the Inputs tab. This means there is one clear place to configure the indicator.

**Benefits include:**

* A cleaner settings window.
* No duplicate appearance controls.
* Less chance of accidentally overriding your own settings.
* A more polished user experience.

---

### **Labels Now Behave Much More Intelligently**

The biggest functional improvement involved the end-of-line labels.

Before this update, the indicator created a brand-new label every time the chart refreshed while the current bar was still forming. Although those labels occupied the same general area on the chart, they continued accumulating behind the scenes.

Most users would never notice this during normal use. However, if the chart remained open for an extended period of time, the script would continue generating more and more label objects.

The new system completely changes that behavior.

Instead of continuously creating new labels, the indicator now creates **one label for each moving average** and simply updates that existing label as conditions change.

As price moves and the moving averages update, those labels move and refresh automatically.

**This means:**

* The label position updates in real time.
* The displayed moving average value updates in real time.
* The moving average description updates if settings are changed.
* Only one label exists for each moving average at any given time.

---

### **Automatic Label Cleanup**

Another improvement is how the indicator handles labels when they are no longer needed.

Previously, labels that had already been created could remain behind after certain settings were changed. For example, disabling a label option did not actively remove previously generated labels.

The updated version actively manages them.

If you disable a label, hide a moving average, or otherwise remove the conditions required for that label to exist, the indicator immediately removes it from the chart.

**As a result:**

* The chart stays visually clean.
* Labels accurately reflect your current settings.
* There are no leftover objects from previous configurations.

---

### **Better Long-Term Reliability**

While the original version functioned correctly, the hidden accumulation of label objects had the potential to create issues during long trading sessions.

TradingView places limits on how many objects an indicator can create. Constantly generating new labels could eventually push the script closer to those limits.

The updated version avoids that problem entirely.

Because the indicator now maintains a fixed number of labels, it behaves the same whether you have had the chart open for five minutes or five days.

**This provides several advantages:**

* More efficient operation.
* Reduced resource consumption.
* Greater stability during extended use.
* Less chance of encountering TradingView object limitations.

---

### **Real-Time Label Updates Were Preserved**

Although the internal label system changed significantly, the user experience remained intact.

The labels still update continuously while the current bar is active. As the underlying moving averages change, the labels adjust automatically to reflect the latest values.

The important difference is that those updates now occur by modifying existing labels rather than creating new ones.

In practical terms, the indicator still feels just as responsive as before—only with a much more efficient implementation behind the scenes.

---

### **No Changes to the Actual Analysis**

It is important to note that these updates did **not** alter the analytical behavior of the indicator.

The moving averages continue to function exactly as they did previously.

The indicator still provides:

* Three independently configurable moving averages.
* Independent timeframe selection for each moving average.
* Support for SMA, EMA, WMA, VWMA, RMA, and HMA calculations.
* Individual color settings.
* Independent line thickness controls.
* Multiple line style options.
* Optional end-of-line labels showing:

* Moving average type,
* Moving average length,
* Source timeframe,
* Current moving average value.

The actual calculations and plotted values remain unchanged.

---

## **Overall Impact**

Taken together, these updates make the indicator feel more refined without altering how traders use it.

The chart appearance remains familiar, the moving averages behave exactly as expected, and the labels continue providing the same information in real time.

The difference is that the indicator is now:

* Easier to configure.
* Cleaner to interact with.
* More efficient behind the scenes.
* Better at managing its own resources.
* More reliable during prolonged use.

From a user's perspective, the indicator should look and behave almost exactly the same as before—just with a noticeably more polished and dependable foundation supporting it.
リリースノート
**Moving Average MTF — Change Log**

**Version 2.1 — June 12, 2026**

---

**Default Timeframes Restructured**

The timeframe defaults across all four MAs have been meaningfully restructured in this version. The previous arrangement spanned from 5-minute up to Daily, which created a very wide and uneven spread — useful in some contexts, but not ideal as a general-purpose starting point. The new default stack tightens everything into a clean intraday progression that steps up evenly and logically from one timeframe to the next.

The updated default timeframe hierarchy is as follows:

- **MA 1** — 5-minute (unchanged)
- **MA 2** — 15-minute (unchanged)
- **MA 3** — 30-minute, changed from 1-hour
- **MA 4** — 1-hour, changed from Daily

The result is a 5m → 15m → 30m → 1h stack where each level is a meaningful step above the last, rather than a large jump to a completely different trading context. This makes the indicator far more immediately useful for intraday traders right out of the box, while still leaving full freedom to reconfigure any MA to any timeframe you prefer.

---

**All MA Lengths Standardized at 200**

Every MA defaults to a length of 200, which has been consistent since version 2.0 and remains unchanged here. The 200-period moving average is one of the most widely watched levels across all asset classes and timeframes, so having all four MAs default to 200 across different timeframes gives you an immediate multi-timeframe view of where that key level sits at each horizon simultaneously.

---

**MA 4 Now Enabled and Fully Visible by Default**

In version 2.0, MA 4 was hidden by default — its show toggle was off, meaning it wouldn't appear on the chart until you manually enabled it. That has been changed. MA 4 now loads fully enabled out of the box, with both the line and the end-of-line label visible from the moment you add the indicator to your chart. This makes the behavior consistent with MA 1, 2, and 3, all of which have always been on by default. There is no longer any need to go into the settings just to activate the fourth MA.

---

**Full Default Settings Summary — Current State**

For reference, here is the complete picture of every MA's default configuration as it stands in version 2.1:

- **MA 1** — 200 SMA, 5-minute, blue, thickness 1, solid line, shown, label shown
- **MA 2** — 200 SMA, 15-minute, orange, thickness 2, solid line, shown, label shown
- **MA 3** — 200 SMA, 30-minute, red, thickness 3, solid line, shown, label shown
- **MA 4** — 200 SMA, 1-hour, purple, thickness 4, solid line, shown, label shown

All settings remain fully customizable. The defaults simply reflect the most practical and immediately useful starting configuration for intraday multi-timeframe analysis.

---

**No Structural or Functional Changes**

Nothing under the hood has been modified. All calculation logic, label behavior, line styling options, MA type options, and multi-timeframe request handling are identical to version 2.0. This is purely a defaults and configuration update.
リリースノート
**Moving Average MTF — Change Log**

---

**Non-Repaint Control**

A new Non-Repaint group was added at the very top of the inputs, above everything else. When enabled, each MA is locked to the last confirmed closed bar of its respective timeframe using a `[1]` offset paired with `lookahead_on`. This means the value won't shift or repaint mid-bar — it holds firm until that timeframe's candle fully closes and a new confirmed bar is available. When disabled, the MA reads the live forming bar of the higher timeframe as it always did. The subtle historical shift you see when toggling this on is correct — every bar on the chart steps back by one HTF bar, which is the honest non-repainting value.

---

**Label System Overhaul**

The four individual per-MA label toggles (`Show MA 1 Label`, `Show MA 2 Label`, etc.) were removed entirely and replaced with a single global Labels group containing three inputs:

- **Show Labels** — one toggle that controls visibility for all four MA labels simultaneously.
- **Label Size** — a dropdown with options Tiny, Small, Normal, and Large. Defaults to Tiny to match the original behavior.
- **Label Offset** — an integer input controlling how many bars to the right of the last bar the labels are positioned. Defaults to `2` to match the original hardcoded value, adjustable from `0` to `50`.

---

**Flash Reduction**

The label update logic was refactored to reduce flickering during live trading. Rather than using `label.set_xy()` which moved both coordinates atomically and could cause a visible blink between render frames, the code now uses separate `label.set_x()`, `label.set_y()`, and `label.set_text()` calls. Labels are mutated in place on each tick rather than being torn down and recreated, which eliminates the main source of the flash. Full elimination would require gating label updates to bar close only, which was intentionally left as-is for now.

---

**Input Groups Unchanged**

The four MA groups — MA 1 through MA 4 — remain structurally identical to the original with no changes to their inputs:

- Show toggle, Length, Timeframe, Type, Line Style, Line Thickness, and Color are all preserved exactly as uploaded.
リリースノート
# Moving Average MTF — Update Description

## **What Was Updated**

A new user control has been added to the **Labels** settings group that gives you the ability to show or hide the price value displayed on each moving average label at the right edge of the chart.

---

## **Where to Find It**

Open the indicator settings and navigate to the **Labels** group. You will see the new toggle sitting directly below the **Show Labels** toggle, making it easy to find and logically grouped with the other label controls. The full Labels section now reads in this order:

- Show Labels
- **Show Price** *(new)*
- Label Size
- Label Offset

---

## **What the New Control Does**

**Show Price** is an on/off toggle that controls whether the current price value of each moving average appears on its label.

- **When turned ON** — each label displays two lines of information: the top line shows the MA type, length, and timeframe (for example, *SMA200 (5m)*), and the bottom line shows the exact price value of that moving average at the current bar.
- **When turned OFF** — each label displays only the single top line with the MA type, length, and timeframe. The price value is completely hidden, giving you a cleaner, more compact label on the chart.

---

## **Default Behavior**

The toggle is **ON by default**, meaning the price value continues to appear on every label exactly as it did before this update. No existing behavior changes unless you actively turn the toggle off.

---

## **Why This Is Useful**

- If your chart is already crowded or you are zoomed out, hiding the price keeps labels small and unobtrusive while still identifying which MA line is which.
- If you only care about the identity of each line and not its exact value at a glance, turning the price off reduces visual noise without losing any functionality.
- The toggle applies globally to all four moving average labels simultaneously, so you do not need to configure it separately for each MA.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。