PROTECTED SOURCE SCRIPT

Moon Phases + Blood Moon

35
What it is

This is a simple, time-based strategy that goes long on full moons and exits on the next new moon, while visually highlighting historically known “Blood Moon” (total lunar eclipse) dates. It’s built for exploratory testing of lunar timing effects on price, not for predictive claims.

Why it’s useful / originality

Most lunar scripts only mark phases. This one (1) computes lunar phases on the chart, (2) normalizes and flags Blood Moon days from a curated list, and (3) turns the phase changes into an executable strategy with clear, reproducible entry/exit rules and a configurable start date—so traders can quickly evaluate whether a lunar timing overlay adds any edge on their market/timeframe.

How it works (concept)

Moon phase detection: Uses Julian date conversion and standard astronomical approximations to determine the most recent phase change at each bar. The script classifies phase turns as +1 = New Moon and –1 = Full Moon, tracking the latest valid time to avoid lookahead.

Blood Moon tagging: A built-in array of UTC timestamps (total lunar eclipses) is date-matched to the current session and marked as “Blood Moon” when a full moon coincides with a listed date.

Signals & trades

Plot circles above/below bars: New Moon (above), Full Moon (below), Blood Moon (below, red).

Entry: Long at Full Moon once the bar time ≥ the user’s Start date.

Exit: Close the long on the next New Moon.

How to use

Add to your chart (non-monthly timeframes only).

Optionally adjust the Start date (default: 2001-12-31 UTC) to control the backtest window.

Use the color inputs to style New Moon / Full Moon / Blood Moon markers.

Evaluate performance on liquid symbols and timeframes that provide a sufficient number of phase cycles.

Default / publish settings

Initial capital: $10,000 (suggested)

Commission: 0.05% per trade (suggested)

Slippage: 1 tick (suggested)

Position sizing: TradingView strategy defaults (no leverage logic is added).

Timeframes: Intraday/Daily/Weekly supported. Monthly is blocked by design.

Chart type: Use standard chart types only (no Heikin Ashi, Renko, Kagi, P&F, Range) for signals/backtests.

Reading the chart

New Moon: soft gray circle above bars.

Full Moon: soft yellow circle below bars.

Blood Moon (if date-matched): soft red circle below bars.

The script also ensures symbol/timeframe context is visible—keep your chart clean so the markers are easy to interpret.

Limitations & important notes

This is a time-based heuristic. It does not forecast price and does not repaint via lookahead tricks; it avoids future leakage by anchoring to the last known phase time at each bar.

No non-standard chart signals. Using non-standard charts can produce unrealistic results.

Strategy properties like commission/slippage materially affect results—please set them to realistic values.

Backtests should include a large sample (ideally >100 trades over many cycles) to make statistics meaningful.

Past performance does not guarantee future results.

Open-source reuse / credits

Uses standard, public-domain techniques for Julian date conversion and lunar-phase approximations.

Blood Moon dates are incorporated as a hard-coded list for convenience; you may extend or adjust this list as needed.

No third-party proprietary code is reused.

Changelog / versioning

v1: Initial public release on Pine v6 with phase detection, Blood-Moon tagging, and a minimal long-only phase strategy.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.