PROTECTED SOURCE SCRIPT

MTF Price Break Alerts

128
📌 MTF Price Break Alerts

This Pine Script is designed to alert you when a bar closes above or below a chosen price level, based on the close of a specific timeframe (MTF) that you set.

🔑 Features in Detail

1. Custom Price Level

You can set any priceLevel you want (e.g., 2000.0).
The script continuously monitors that level against the chosen timeframe’s close.

2. Single Timeframe Monitoring

You choose one timeframe (tf) using the input box (e.g., "15", "60", "240", "D"), ensures signals are only confirmed after that bar has closed (no repainting).

3. Crossover Detection

Triggers when the MTF close crosses from below to above or from above to below your price level. You only get alerts once per cross (not every bar staying above/below).

4. Dynamic Alerts

✅ This generates dynamic messages showing both the timeframe label and the price level.

Example messages:

Bar on M15 closes ABOVE 2000.0
Bar on H1 closes BELOW 2000.0

👉 To use:
When setting up an alert in TradingView, pick “Any alert() function call”.

Timeframe Labels (Friendly Format)

Raw inputs like "15", "60", "240", "D", "W" are auto-formatted to trading-friendly labels:

"15" → M15

"60" → H1

"240" → H4

"D" → D1

"W" → W1

Keeps alerts easy to read.

Optional Background Highlight

A visual cue on the chart (green or red shading) when conditions are met.
Controlled with the toggle showBg.
Doesn’t clutter the chart with lines/plots.

⚡ Example Use Case

Let’s say:
You want to watch H1 closes above/below 2000.

You set priceLevel = 2000.0 and tf = "60".
On every H1 close, the script checks:

If the H1 close moves from below → above 2000 → alert:
Bar on H1 closes ABOVE 2000.0

If the H1 close moves from above → below 2000 → alert:
Bar on H1 closes BELOW 2000.0

This is very useful for S/R level monitoring, breakout alerts, and key price action watching across higher timeframes, even while sitting on a lower timeframe chart.

🛠 Limitations

Monitors only one timeframe per script instance (but you can load multiple copies on the chart for multiple TFs or price levels).

Alerts are triggered only once per crossover (not for every bar staying above/below).
Alert message precision uses raw price (e.g., 2000 or 2000.12345).

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.