PINE LIBRARY
LunarSolver

LunarSolver Library
Implements analytical approximations from Éphéméride Lunaire Parisienne (ELP2000-82B) lunar theory (Chapront-Touzé & Chapront). Uses truncated Fourier series of the main problem in Delaunay arguments D, l, l', F.
Exported functions:
Accuracy (truncation-limited):
- Distance: typically ± 10 - 100 km.
- Syzygy times: typically ± few minutes.
Import:
Pine Script®
Usage examples:
Pine Script®
Coefficients: top 50 terms by amplitude from ELP main problem series (radius vector & longitude). Phase solvers use longitude terms only. Library contains no latitude series.
Disclaimer: The library was developed with assistance from Grok 4.1, always under human supervision and decision-making.
Implements analytical approximations from Éphéméride Lunaire Parisienne (ELP2000-82B) lunar theory (Chapront-Touzé & Chapront). Uses truncated Fourier series of the main problem in Delaunay arguments D, l, l', F.
Exported functions:
- delta_t(t_ms) → ΔT (seconds); polynomial fit valid ~1950–2050.
- julian_day_tt(t_ms) → JD in Terrestrial Time from UTC millisecond timestamp.
- jde_tt_to_utc_ms(jde_tt) → Approximate UTC millisecond timestamp from JD TT.
- elp_true_distance_km_50(jd_tt) → Geocentric distance (km); 50 largest-amplitude terms.
- elp_new_moon_solver_50(k) → JDE TT of new moon nearest lunation number k (k=0 ≈ 2000-01-06); 50-term longitude series + Newton-Raphson iteration (convergence <0.005 days).
- elp_full_moon_solver_50(k) → JDE TT of full moon nearest k (k=0 ≈ 2000-01-21); 50-term longitude series + nutation correction + damped iteration (convergence <0.001 days).
Accuracy (truncation-limited):
- Distance: typically ± 10 - 100 km.
- Syzygy times: typically ± few minutes.
Import:
import telephonejack/LunarSolver/1 as lunar
Usage examples:
//@version=6
indicator("Lunar Distance Demo")
float jd_tt = lunar.julian_day_tt(time)
float dist_km = lunar.elp_true_distance_km_50(jd_tt)
plot(dist_km, "Distance (km)")
// Approximate lunation k for current bar
float k_approx = (lunar.julian_day_tt(time) - 2451550.25977) / 29.530588861
int k = math.round(k_approx)
float new_jde = lunar.elp_new_moon_solver_50(k)
float full_jde = lunar.elp_full_moon_solver_50(k)
Coefficients: top 50 terms by amplitude from ELP main problem series (radius vector & longitude). Phase solvers use longitude terms only. Library contains no latitude series.
Disclaimer: The library was developed with assistance from Grok 4.1, always under human supervision and decision-making.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
Contact via DM here or on X to inquire about access to invite-only scripts.
Crystal Ball Tech Discord server to join the discussion:
discord.gg/xrgxjgHD
Crystal Ball Tech Discord server to join the discussion:
discord.gg/xrgxjgHD
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
Contact via DM here or on X to inquire about access to invite-only scripts.
Crystal Ball Tech Discord server to join the discussion:
discord.gg/xrgxjgHD
Crystal Ball Tech Discord server to join the discussion:
discord.gg/xrgxjgHD
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.