OPEN-SOURCE SCRIPT
Breaking Ray [vganesh]

Breaking Ray [vganesh] — Anchor a Level, Watch It Break
## Overview
Breaking Ray [vganesh] anchors a horizontal ray to a single candle you click on — its top, bottom, or both. The ray extends forward indefinitely, exactly like TradingView's built-in Ray drawing tool, until price actually breaks it. At that moment it freezes into a fixed line segment running from the anchor candle to the candle that broke it, so your chart keeps a permanent, uncluttered record of exactly when and where a level gave way.
It works the same way the built-in Anchored VWAP does: add the indicator, click the candle you want to anchor to, and you're done. Want to track several candles at once? Add another instance of the indicator for each one — every instance is independent.
## How It Works
- **Anchoring**: click any candle (or reposition later via the target icon in Settings) to set the ray's origin. You choose whether it originates from that candle's high, low, or both.
- **Breaking**: each bar, the script checks whether price has broken the level (wick or close, your choice). The instant it does, the ray stops extending and locks into a plain line segment — a visual record of exactly how long that level held.
- **Multi-timeframe aware**: set "Anchor Candle's Timeframe" to the timeframe you clicked on (e.g. "D" for a Daily candle), and the ray will show the correct level and starting point no matter what timeframe you switch the chart to afterward.
## Key Features
- Click-to-anchor UX — no manual price/time entry required
- Draw from the candle's Top, Bottom, or Both
- Break detection by wick touch or candle close
- Optional halo line and a price label (Left / Center / Right anchored) so the ray stays legible even on busy, lower-timeframe charts
- Broken rays can be kept as a permanent segment or discarded entirely
- Built-in alerts, including a dynamic message with the ticker, which side broke, and the exact price
- On-chart diagnostics (an optional debug label) if a ray isn't behaving as expected
## How To Use
1. Add the indicator to your chart.
2. Click the candle you want to anchor to when prompted.
3. If you plan to view the ray on a timeframe other than the one you clicked on, set "Anchor Candle's Timeframe" to match (e.g. "D", "4H").
4. Choose Top, Bottom, or Both under "Draw Ray From".
5. Adjust style, break sensitivity, and label settings to taste.
6. Repeat with a new indicator instance for each additional candle you want to track.
## Alerts
Create an alert on this indicator with the condition **"Any alert() function call"** and set the alert's Message field to `{{alert_message}}` to receive the dynamic message: `{{ticker}} Top ray broken at <price>` (or Bottom). A generic "Ray Broken" condition is also available for a simple yes/no trigger.
## Notes
- One indicator instance tracks one anchor candle by design — this keeps each ray independently configurable (its own color, break rule, timeframe, etc.).
- The ray's exact starting bar is timeframe-dependent: it points to the specific candle where the high/low actually printed, so the same anchor can look slightly different in position (never in price) depending on what timeframe you're viewing.
## Disclaimer
This script is provided for informational and educational purposes only. It does not constitute financial advice, and past levels holding or breaking are not indicative of future price behavior. Always do your own research and manage risk appropriately.
## Overview
Breaking Ray [vganesh] anchors a horizontal ray to a single candle you click on — its top, bottom, or both. The ray extends forward indefinitely, exactly like TradingView's built-in Ray drawing tool, until price actually breaks it. At that moment it freezes into a fixed line segment running from the anchor candle to the candle that broke it, so your chart keeps a permanent, uncluttered record of exactly when and where a level gave way.
It works the same way the built-in Anchored VWAP does: add the indicator, click the candle you want to anchor to, and you're done. Want to track several candles at once? Add another instance of the indicator for each one — every instance is independent.
## How It Works
- **Anchoring**: click any candle (or reposition later via the target icon in Settings) to set the ray's origin. You choose whether it originates from that candle's high, low, or both.
- **Breaking**: each bar, the script checks whether price has broken the level (wick or close, your choice). The instant it does, the ray stops extending and locks into a plain line segment — a visual record of exactly how long that level held.
- **Multi-timeframe aware**: set "Anchor Candle's Timeframe" to the timeframe you clicked on (e.g. "D" for a Daily candle), and the ray will show the correct level and starting point no matter what timeframe you switch the chart to afterward.
## Key Features
- Click-to-anchor UX — no manual price/time entry required
- Draw from the candle's Top, Bottom, or Both
- Break detection by wick touch or candle close
- Optional halo line and a price label (Left / Center / Right anchored) so the ray stays legible even on busy, lower-timeframe charts
- Broken rays can be kept as a permanent segment or discarded entirely
- Built-in alerts, including a dynamic message with the ticker, which side broke, and the exact price
- On-chart diagnostics (an optional debug label) if a ray isn't behaving as expected
## How To Use
1. Add the indicator to your chart.
2. Click the candle you want to anchor to when prompted.
3. If you plan to view the ray on a timeframe other than the one you clicked on, set "Anchor Candle's Timeframe" to match (e.g. "D", "4H").
4. Choose Top, Bottom, or Both under "Draw Ray From".
5. Adjust style, break sensitivity, and label settings to taste.
6. Repeat with a new indicator instance for each additional candle you want to track.
## Alerts
Create an alert on this indicator with the condition **"Any alert() function call"** and set the alert's Message field to `{{alert_message}}` to receive the dynamic message: `{{ticker}} Top ray broken at <price>` (or Bottom). A generic "Ray Broken" condition is also available for a simple yes/no trigger.
## Notes
- One indicator instance tracks one anchor candle by design — this keeps each ray independently configurable (its own color, break rule, timeframe, etc.).
- The ray's exact starting bar is timeframe-dependent: it points to the specific candle where the high/low actually printed, so the same anchor can look slightly different in position (never in price) depending on what timeframe you're viewing.
## Disclaimer
This script is provided for informational and educational purposes only. It does not constitute financial advice, and past levels holding or breaking are not indicative of future price behavior. Always do your own research and manage risk appropriately.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.