Triple MTF MA Painter - Directional TogglesThis Pine Script is a **multi-filter trend-following indicator**. It acts as a "gatekeeper," only allowing a signal to fire when price action, momentum, and volume (if selected) all align in the same direction across up to three different moving averages and timeframes.
Here is a breakdown of how the logic flows from the code to your chart:
### 1. The Triple-Filter Architecture
The code uses three independent Moving Average (MA) engines. You can configure each one to be a different type:
* **SMA/EMA:** For standard price smoothing.
* **VWMA:** To ensure the trend is backed by high trading volume.
* **ZLEMA:** To catch price reversals with almost zero lag.
Each MA also has a **Multi-Timeframe (MTF)** capability. This means you can be on a 5-minute chart but only see signals when the price is above the **Daily** or **4-Hour** trend line.
### 2. The Logic Filter (The "Gate")
The script calculates whether the current price is "cleared" for a signal:
* **Bullish Condition:** Price must be above MA 1 **AND** MA 2 **AND** MA 3.
* **Bearish Condition:** Price must be below MA 1 **AND** MA 2 **AND** MA 3.
> **Note:** If you toggle an MA "OFF" in the settings, the code intelligently ignores it so it doesn't block your signals.
### 3. Price Action Trigger
Even if the price is above all three MAs, the code won't fire a signal until it sees a specific candle pattern:
* **Bullish Trigger:** The current bar's High and Low must both be higher than the previous bar's High and Low.
* **Bearish Trigger:** The current bar's High and Low must both be lower than the previous bar's High and Low.
### 4. The State Machine (The "Memory")
To prevent the chart from becoming cluttered with 20 labels in a row during a long trend, I implemented a **State Machine**.
* Once a **Bullish** signal triggers, the script "remembers" it.
* It will refuse to show another Bullish signal until a **Bearish** signal occurs to reset the cycle.
* This ensures you only see the **first** valid entry point of a new trend.
### 5. UI and Customization
The code is designed to be user-friendly without needing to look at the script:
* **Directional Toggles:** You can hide all bearish signals if you only want to go long.
* **Visual Toggles:** You can turn off the bar coloring if it interferes with your other indicators, keeping only the labels.
* **Source Selection:** You can choose to calculate the MAs based on `Close`, `Open`, or even the `HL2` (midpoint of the bar).
---
### Summary of Workflow
1. **Check MAs:** Is price above/below all active MAs?
2. **Check Timeframe:** Are the higher timeframe trends in agreement?
3. **Check Pattern:** Did the current candle break the previous candle's range?
4. **Check History:** Is this a new trend direction, or are we already in one?
5. **Output:** If all checks pass, paint the bar and drop a label.
Would you like me to add a **Stop Loss / Take Profit** calculation to the labels so you know exactly where to exit the trade?
Penunjuk Pine Script®






















