OPEN-SOURCE SCRIPT
Zfx Lunar Phase Engine

Zfx — Lunar Phase Engine
This indicator maps the synodic lunar cycle directly onto your price chart using precise astronomical timing. The lunar wave is calculated from a verified new moon epoch and plotted as a smooth sine oscillator on the left scale, allowing you to overlay the natural 29.5-day moon cycle against any market on any timeframe — without cluttering your price action.
What it does:
- Computes real-time lunar phase (0 = New Moon → 0.5 = Full Moon → 1 = back to New Moon) using the synodic month constant (2,551,442 seconds)
- Plots the wave on the left scale directly over price — candles remain fully readable
- Marks all four lunar phases with vertical lines and emoji anchors: 🌑 New Moon (cyan), 🌓 First Quarter, 🌕 Full Moon (gold), 🌗 Third Quarter
- Projects the next 3 upcoming phase events forward in time as dashed future lines
- Displays a live data table: current illumination % and days until the next New/Full Moon
- Optional waxing/waning background shading
Why it matters:
Lunar cycles have been studied in relation to market sentiment, liquidity windows, and turning points across commodities, indices, and crypto. This tool makes it effortless to visually correlate price behaviour with the moon's phase without any manual calculation.
Settings:
- Toggle quarter moon markers on/off
- Toggle background shading on/off
- Toggle the data table on/off
- All alert conditions included for all 4 phase transitions
Built for clean, uncluttered overlay use on any symbol and any timeframe.
---
That framing is distinct enough — it emphasises the astronomical calculation, the overlay approach, the left-scale design, and the forward projection, which differentiates it from generic lunar scripts.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。