Indicator · Pine Script v5 · On the chart

Celestial Events & Planetary Lines

by aidatatools-dev

Celestial Events & Planetary Lines plots Gann-style geocentric and heliocentric planetary lines directly on the main chart alongside astronomical event markers.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code459
Settings24inputs
LicenceMIT
Last update3 weeks ago30 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

459 lines of Pine Script v5 from tradingview/celestial_events_planetary_lines.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

celestial_events_planetary_lines.pine
//@version=5
// Celestial Events & Planetary Lines
// MIT License
//
// Gann planetary lines (geocentric and heliocentric), sign ingresses, stations (retrograde / direct)
// and eclipses, drawn on any chart. For your own analysis: not a trading signal, not a forecast.
//
// Two kinds of numbers, stated plainly:
//   * Events (ingresses, stations, eclipses) are EXACT: a table of 3,666 events 1990-2040,
//     each to the minute (UTC), computed in advance from the NASA/JPL DE440 ephemeris.
//   * Planetary lines are APPROXIMATE: Pine Script cannot load an ephemeris, so longitudes come from JPL's
//     Keplerian elements (Standish, Table 1, 1800-2050) with precession, nutation and light-time.
//     Measured against DE440 1990-2040: max error Sun <1', Mercury 1', Venus 2', Mars 4', Jupiter 5', Saturn 11', Uranus 2', Neptune 1', Pluto 1', Earth <1' (arcminutes, geocentric or heliocentric).
//
// Generated file: the event table is built by a script, edit the template, not this file.

indicator("Celestial Events & Planetary Lines", shorttitle = "Celestial", overlay = true,
     max_labels_count = 500, max_polylines_count = 100)

// ---------------------------------------------------------------- inputs
G_LINES = "Planetary lines (price = (degree + step x k) x price per degree)"
showGeo   = input.bool(true, "Geocentric lines", group = G_LINES, inline = "persp")
showHelio = input.bool(false, "Heliocentric lines", group = G_LINES, inline = "persp")
unitIn    = input.float(0.0, "Price per degree (0 = auto)", minval = 0.0, group = G_LINES,
     tooltip = "1 degree of longitude = this many price units. 0 picks a power of ten from the current price (10^(digits - 3)), which changes when price crosses a power of ten. Gann practice: 1, 10, 100... chosen by the user.")
stepDeg   = input.int(360, "A line every (degrees)", options = [360, 180, 120, 90, 60, 45, 30], group = G_LINES,
     tooltip = "360 = one line per full turn. 180 adds the opposition, 90 the squares, 120 the trines...")
projectDays = input.int(60, "Project lines forward (days, 0 = off)", minval = 0, maxval = 365, group = G_LINES)
lineWidth = input.int(1, "Line width", minval = 1, maxval = 4, group = G_LINES)

G_BODIES = "Bodies (lines and events)"
bSun = input.bool(true,  "Sun (geo) / Earth (helio)", group = G_BODIES, inline = "b1")
bMer = input.bool(false, "Mercury", group = G_BODIES, inline = "b1")
bVen = input.bool(false, "Venus",   group = G_BODIES, inline = "b2")
bMar = input.bool(true,  "Mars",    group = G_BODIES, inline = "b2")
bJup = input.bool(true,  "Jupiter", group = G_BODIES, inline = "b3")
bSat = input.bool(true,  "Saturn",  group = G_BODIES, inline = "b3")
bUra = input.bool(false, "Uranus",  group = G_BODIES, inline = "b4")
bNep = input.bool(false, "Neptune", group = G_BODIES, inline = "b4")
bPlu = input.bool(false, "Pluto",   group = G_BODIES, inline = "b5")
bM5  = input.bool(false, "Mean of 5 (Jupiter..Pluto)", group = G_BODIES, inline = "b6")
bC8  = input.bool(false, "Circle of 8 (Mercury..Pluto)", group = G_BODIES, inline = "b6")

G_EVENTS = "Events (exact, DE440)"
evIngress = input.bool(true, "Sign ingresses", group = G_EVENTS, inline = "e1")
evStation = input.bool(true, "Stations", group = G_EVENTS, inline = "e1")
evEclipse = input.bool(true, "Eclipses", group = G_EVENTS, inline = "e1")
evAll     = input.bool(false, "Events for every body (not only the selected ones)", group = G_EVENTS)
evFuture  = input.bool(true, "Show upcoming events (within the projection window)", group = G_EVENTS)

G_SHOW = "Display"
showTable = input.bool(true, "Positions table", group = G_SHOW)
tablePos  = input.string("bottom right", "Table position", options = ["top right", "bottom right", "bottom left", "top left"], group = G_SHOW)

// ---------------------------------------------------------------- ephemeris (approximate)
D2R = math.pi / 180.0
// a (au), e, I, L, long. perihelion, long. node, then their rates per Julian century; J2000 ecliptic.
// Order: 0 Mercury, 1 Venus, 2 Earth-Moon barycentre, 3 Mars, 4 Jupiter, 5 Saturn, 6 Uranus, 7 Neptune, 8 Pluto.
var float[] ELEM = array.from(
     0.38709927, 0.20563593, 7.00497902, 252.25032350, 77.45779628, 48.33076593, 0.00000037, 0.00001906, -0.00594749, 149472.67411175, 0.16047689, -0.12534081,
     0.72333566, 0.00677672, 3.39467605, 181.97909950, 131.60246718, 76.67984255, 0.00000390, -0.00004107, -0.00078890, 58517.81538729, 0.00268329, -0.27769418,
     1.00000261, 0.01671123, -0.00001531, 100.46457166, 102.93768193, 0.00000000, 0.00000562, -0.00004392, -0.01294668, 35999.37244981, 0.32327364, 0.00000000,
     1.52371034, 0.09339410, 1.84969142, -4.55343205, -23.94362959, 49.55953891, 0.00001847, 0.00007882, -0.00813131, 19140.30268499, 0.44441088, -0.29257343,
     5.20288700, 0.04838624, 1.30439695, 34.39644051, 14.72847983, 100.47390909, -0.00011607, -0.00013253, -0.00183714, 3034.74612775, 0.21252668, 0.20469106,
     9.53667594, 0.05386179, 2.48599187, 49.95424423, 92.59887831, 113.66242448, -0.00125060, -0.00050991, 0.00193609, 1222.49362201, -0.41897216, -0.28867794,
     19.18916464, 0.04725744, 0.77263783, 313.23810451, 170.95427630, 74.01692503, -0.00196176, -0.00004397, -0.00242939, 428.48202785, 0.40805281, 0.04240589,
     30.06992276, 0.00859048, 1.77004347, -55.12002969, 44.96476227, 131.78422574, 0.00026291, 0.00005105, 0.00035372, 218.45945325, -0.32241464, -0.00508664,
     39.48211675, 0.24882730, 17.14001206, 238.92903833, 224.06891629, 110.30393684, -0.00031596, 0.00005170, 0.00004818, 145.20780515, -0.04062942, -0.01183482)

el(int b, int i) =>
    array.get(ELEM, b * 12 + i)

mod360(float x) =>
    x - 360.0 * math.floor(x / 360.0)

wrap180(float x) =>
    mod360(x + 180.0) - 180.0

atan2deg(float y, float x) =>
    float r = 0.0
    if x > 0
        r := math.atan(y / x)
    else if x < 0
        r := math.atan(y / x) + (y >= 0 ? math.pi : -math.pi)
    else
        r := y > 0 ? math.pi / 2 : y < 0 ? -math.pi / 2 : 0.0
    r / D2R

centuries(int t) =>
    (t / 86400000.0 + 2440587.5 - 2451545.0) / 36525.0

// Short-period Saturn terms on Jupiter (degrees); the great inequality is already in the elements.
jupiterPert(float T) =>
    float mj = (el(4, 3) - el(4, 4) + (el(4, 9) - el(4, 10)) * T) * D2R
    float ms = (el(5, 3) - el(5, 4) + (el(5, 9) - el(5, 10)) * T) * D2R
    -0.056 * math.sin(2 * mj - 2 * ms + 21 * D2R) + 0.042 * math.sin(3 * mj - 5 * ms + 21 * D2R) - 0.036 * math.sin(mj - 2 * ms) + 0.022 * math.cos(mj - ms) + 0.023 * math.sin(2 * mj - 3 * ms + 52 * D2R) - 0.016 * math.sin(mj - 5 * ms - 69 * D2R)

// Heliocentric ecliptic J2000 coordinates (au).
helioXYZ(int b, float T) =>
    float a    = el(b, 0) + el(b, 6) * T
    float e    = el(b, 1) + el(b, 7) * T
    float inc  = (el(b, 2) + el(b, 8) * T) * D2R
    float lng  = el(b, 3) + el(b, 9) * T
    float wbar = el(b, 4) + el(b, 10) * T
    float node = el(b, 5) + el(b, 11) * T
    float w = (wbar - node) * D2R
    float M = mod360(lng - wbar)
    if M > 180.0
        M -= 360.0
    float Mr = M * D2R
    float E = Mr + e * math.sin(Mr)
    for k = 0 to 5
        E -= (E - e * math.sin(E) - Mr) / (1.0 - e * math.cos(E))
    float xp = a * (math.cos(E) - e)
    float yp = a * math.sqrt(1.0 - e * e) * math.sin(E)
    if b == 4
        float dj = jupiterPert(T) * D2R
        float xr = xp * math.cos(dj) - yp * math.sin(dj)
        yp := xp * math.sin(dj) + yp * math.cos(dj)
        xp := xr
    float cw = math.cos(w), sw = math.sin(w)
    float cn = math.cos(node * D2R), sn = math.sin(node * D2R)
    float ci = math.cos(inc), si = math.sin(inc)
    float x = (cw * cn - sw * sn * ci) * xp + (-sw * cn - cw * sn * ci) * yp
    float y = (cw * sn + sw * cn * ci) * xp + (-sw * sn + cw * cn * ci) * yp
    float z = sw * si * xp + cw * si * yp
    [x, y, z]

// J2000 ecliptic longitude -> true ecliptic and equinox of date.
ofDate(float lonJ2000, float T) =>
    float prec = (5028.796195 * T + 1.1054348 * T * T) / 3600.0
    float om = (125.04452 - 1934.136261 * T) * D2R
    float ls = (280.4665 + 36000.7698 * T) * D2R
    float lm = (218.3165 + 481267.8813 * T) * D2R
    float nut = (-17.20 * math.sin(om) - 1.32 * math.sin(2 * ls) - 0.23 * math.sin(2 * lm) + 0.21 * math.sin(2 * om)) / 3600.0
    mod360(lonJ2000 + prec + nut)

helioLon(int b, float T) =>
    [x, y, z] = helioXYZ(b, T)
    ofDate(atan2deg(y, x), T)

// Geocentric apparent longitude; b = 2 is the Sun (seen from the Earth).
geoLon(int b, float T) =>
    [ex, ey, ez] = helioXYZ(2, T)
    float lon = 0.0
    if b == 2
        lon := atan2deg(-ey, -ex) - 20.4898 / 3600.0
    else
        [x0, y0, z0] = helioXYZ(b, T)
        float dist = math.sqrt((x0 - ex) * (x0 - ex) + (y0 - ey) * (y0 - ey) + (z0 - ez) * (z0 - ez))
        [x1, y1, z1] = helioXYZ(b, T - dist * 0.0057755183 / 36525.0)
        lon := atan2deg(y1 - ey, x1 - ex)
    ofDate(lon, T)

// A line's base degree: id 0-8 a body (2 = Sun geo / Earth helio), 9 Mean of 5, 10 Circle of 8 (arithmetic means).
baseDeg(int persp, int id, float T) =>
    float d = na
    if id <= 8
        d := persp == 0 ? geoLon(id, T) : helioLon(id, T)
    else
        float s = 0.0
        int n = 0
        for b = (id == 9 ? 4 : 0) to 8
            if b != 2
                s += persp == 0 ? geoLon(b, T) : helioLon(b, T)
                n += 1
        d := s / n
    d

// ---------------------------------------------------------------- planetary lines
float Tbar = centuries(time)
float unit = unitIn > 0 ? unitIn : math.pow(10, math.floor(math.log10(close)) - 3)

isOn(int id) =>
    switch id
        0 => bMer
        1 => bVen
        2 => bSun
        3 => bMar
        4 => bJup
        5 => bSat
        6 => bUra
        7 => bNep
        8 => bPlu
        9 => bM5
        => bC8

// The two lines nearest to price: the harmonic just below the close and the one just above.
// A one-bar gap marks the moment price crosses a line (the nearest pair changes).
nearLine(bool on, float deg, float u, int above) =>
    float v = on ? u * (deg + stepDeg * (math.floor((close / u - deg) / stepDeg) + above)) : na
    float vp = v[1]
    na(vp) or math.abs(v - vp) < stepDeg * u * 0.5 ? v : na

C_MER = color.new(#8c8c8c, 0), C_VEN = color.new(#2e9e5b, 0), C_SUN = color.new(#e8a400, 0), C_MAR = color.new(#d63c2f, 0)
C_JUP = color.new(#3d6fd9, 0), C_SAT = color.new(#7a5230, 0), C_URA = color.new(#17a2b8, 0), C_NEP = color.new(#6f42c1, 0)
C_PLU = color.new(#333333, 0), C_M5 = color.new(#d6336c, 0), C_C8 = color.new(#fd7e14, 0)

bodyColor(int id) =>
    switch id
        0 => C_MER
        1 => C_VEN
        2 => C_SUN
        3 => C_MAR
        4 => C_JUP
        5 => C_SAT
        6 => C_URA
        7 => C_NEP
        8 => C_PLU
        9 => C_M5
        => C_C8

bool g0 = showGeo and bMer, bool g1 = showGeo and bVen, bool g2 = showGeo and bSun, bool g3 = showGeo and bMar
bool g4 = showGeo and bJup, bool g5 = showGeo and bSat, bool g6 = showGeo and bUra, bool g7 = showGeo and bNep
bool g8 = showGeo and bPlu, bool g9 = showGeo and bM5, bool g10 = showGeo and bC8
bool h0 = showHelio and bMer, bool h1 = showHelio and bVen, bool h2 = showHelio and bSun, bool h3 = showHelio and bMar
bool h4 = showHelio and bJup, bool h5 = showHelio and bSat, bool h6 = showHelio and bUra, bool h7 = showHelio and bNep
bool h8 = showHelio and bPlu, bool h9 = showHelio and bM5, bool h10 = showHelio and bC8

float gd0 = g0 ? baseDeg(0, 0, Tbar) : na, float gd1 = g1 ? baseDeg(0, 1, Tbar) : na, float gd2 = g2 ? baseDeg(0, 2, Tbar) : na
float gd3 = g3 ? baseDeg(0, 3, Tbar) : na, float gd4 = g4 ? baseDeg(0, 4, Tbar) : na, float gd5 = g5 ? baseDeg(0, 5, Tbar) : na
float gd6 = g6 ? baseDeg(0, 6, Tbar) : na, float gd7 = g7 ? baseDeg(0, 7, Tbar) : na, float gd8 = g8 ? baseDeg(0, 8, Tbar) : na
float gd9 = g9 ? baseDeg(0, 9, Tbar) : na, float gd10 = g10 ? baseDeg(0, 10, Tbar) : na
float hd0 = h0 ? baseDeg(1, 0, Tbar) : na, float hd1 = h1 ? baseDeg(1, 1, Tbar) : na, float hd2 = h2 ? baseDeg(1, 2, Tbar) : na
float hd3 = h3 ? baseDeg(1, 3, Tbar) : na, float hd4 = h4 ? baseDeg(1, 4, Tbar) : na, float hd5 = h5 ? baseDeg(1, 5, Tbar) : na
float hd6 = h6 ? baseDeg(1, 6, Tbar) : na, float hd7 = h7 ? baseDeg(1, 7, Tbar) : na, float hd8 = h8 ? baseDeg(1, 8, Tbar) : na
float hd9 = h9 ? baseDeg(1, 9, Tbar) : na, float hd10 = h10 ? baseDeg(1, 10, Tbar) : na

GEO = plot.style_linebr
plot(nearLine(g0, gd0, unit, 0), "Geo Mercury below", C_MER, lineWidth, GEO)
plot(nearLine(g0, gd0, unit, 1), "Geo Mercury above", C_MER, lineWidth, GEO)
plot(nearLine(g1, gd1, unit, 0), "Geo Venus below", C_VEN, lineWidth, GEO)
plot(nearLine(g1, gd1, unit, 1), "Geo Venus above", C_VEN, lineWidth, GEO)
plot(nearLine(g2, gd2, unit, 0), "Geo Sun below", C_SUN, lineWidth, GEO)
plot(nearLine(g2, gd2, unit, 1), "Geo Sun above", C_SUN, lineWidth, GEO)
plot(nearLine(g3, gd3, unit, 0), "Geo Mars below", C_MAR, lineWidth, GEO)
plot(nearLine(g3, gd3, unit, 1), "Geo Mars above", C_MAR, lineWidth, GEO)
plot(nearLine(g4, gd4, unit, 0), "Geo Jupiter below", C_JUP, lineWidth, GEO)
plot(nearLine(g4, gd4, unit, 1), "Geo Jupiter above", C_JUP, lineWidth, GEO)
plot(nearLine(g5, gd5, unit, 0), "Geo Saturn below", C_SAT, lineWidth, GEO)
plot(nearLine(g5, gd5, unit, 1), "Geo Saturn above", C_SAT, lineWidth, GEO)
plot(nearLine(g6, gd6, unit, 0), "Geo Uranus below", C_URA, lineWidth, GEO)
plot(nearLine(g6, gd6, unit, 1), "Geo Uranus above", C_URA, lineWidth, GEO)
plot(nearLine(g7, gd7, unit, 0), "Geo Neptune below", C_NEP, lineWidth, GEO)
plot(nearLine(g7, gd7, unit, 1), "Geo Neptune above", C_NEP, lineWidth, GEO)
plot(nearLine(g8, gd8, unit, 0), "Geo Pluto below", C_PLU, lineWidth, GEO)
plot(nearLine(g8, gd8, unit, 1), "Geo Pluto above", C_PLU, lineWidth, GEO)
plot(nearLine(g9, gd9, unit, 0), "Geo Mean of 5 below", C_M5, lineWidth, GEO)
plot(nearLine(g9, gd9, unit, 1), "Geo Mean of 5 above", C_M5, lineWidth, GEO)
plot(nearLine(g10, gd10, unit, 0), "Geo Circle of 8 below", C_C8, lineWidth, GEO)
plot(nearLine(g10, gd10, unit, 1), "Geo Circle of 8 above", C_C8, lineWidth, GEO)
HEL = plot.style_circles
plot(nearLine(h0, hd0, unit, 0), "Helio Mercury below", C_MER, lineWidth, HEL)
plot(nearLine(h0, hd0, unit, 1), "Helio Mercury above", C_MER, lineWidth, HEL)
plot(nearLine(h1, hd1, unit, 0), "Helio Venus below", C_VEN, lineWidth, HEL)
plot(nearLine(h1, hd1, unit, 1), "Helio Venus above", C_VEN, lineWidth, HEL)
plot(nearLine(h2, hd2, unit, 0), "Helio Earth below", C_SUN, lineWidth, HEL)
plot(nearLine(h2, hd2, unit, 1), "Helio Earth above", C_SUN, lineWidth, HEL)
plot(nearLine(h3, hd3, unit, 0), "Helio Mars below", C_MAR, lineWidth, HEL)
plot(nearLine(h3, hd3, unit, 1), "Helio Mars above", C_MAR, lineWidth, HEL)
plot(nearLine(h4, hd4, unit, 0), "Helio Jupiter below", C_JUP, lineWidth, HEL)
plot(nearLine(h4, hd4, unit, 1), "Helio Jupiter above", C_JUP, lineWidth, HEL)
plot(nearLine(h5, hd5, unit, 0), "Helio Saturn below", C_SAT, lineWidth, HEL)
plot(nearLine(h5, hd5, unit, 1), "Helio Saturn above", C_SAT, lineWidth, HEL)
plot(nearLine(h6, hd6, unit, 0), "Helio Uranus below", C_URA, lineWidth, HEL)
plot(nearLine(h6, hd6, unit, 1), "Helio Uranus above", C_URA, lineWidth, HEL)
plot(nearLine(h7, hd7, unit, 0), "Helio Neptune below", C_NEP, lineWidth, HEL)
plot(nearLine(h7, hd7, unit, 1), "Helio Neptune above", C_NEP, lineWidth, HEL)
plot(nearLine(h8, hd8, unit, 0), "Helio Pluto below", C_PLU, lineWidth, HEL)
plot(nearLine(h8, hd8, unit, 1), "Helio Pluto above", C_PLU, lineWidth, HEL)
plot(nearLine(h9, hd9, unit, 0), "Helio Mean of 5 below", C_M5, lineWidth, HEL)
plot(nearLine(h9, hd9, unit, 1), "Helio Mean of 5 above", C_M5, lineWidth, HEL)
plot(nearLine(h10, hd10, unit, 0), "Helio Circle of 8 below", C_C8, lineWidth, HEL)
plot(nearLine(h10, hd10, unit, 1), "Helio Circle of 8 above", C_C8, lineWidth, HEL)

// Forward projection (dotted): the same two harmonics, continued from the last bar. TradingView draws
// at most 500 bars ahead, so the window is also capped at 490 bars of the chart's timeframe.
int horizonMs = int(math.min(projectDays * 86400000.0, 490.0 * nz(timeframe.in_seconds(), 86400) * 1000.0))
var polyline[] projections = array.new<polyline>()
if barstate.islast
    while array.size(projections) > 0
        polyline.delete(array.pop(projections))
    if projectDays > 0
        int steps = 120
        for persp = 0 to 1
            for id = 0 to 10
                if (persp == 0 ? showGeo : showHelio) and isOn(id)
                    float d0 = baseDeg(persp, id, Tbar)
                    float k = math.floor((close / unit - d0) / stepDeg)
                    chart.point[] lo = array.new<chart.point>()
                    chart.point[] hi = array.new<chart.point>()
                    float cum = d0
                    float prev = d0
                    for i = 0 to steps
                        int t = time + int(i * horizonMs / steps)
                        float d = baseDeg(persp, id, centuries(t))
                        cum += wrap180(d - prev)
                        prev := d
                        array.push(lo, chart.point.from_time(t, unit * (cum + stepDeg * k)))
                        array.push(hi, chart.point.from_time(t, unit * (cum + stepDeg * (k + 1))))
                    color c = bodyColor(id)
                    array.push(projections, polyline.new(lo, xloc = xloc.bar_time, line_color = c, line_style = persp == 0 ? line.style_dotted : line.style_dashed, line_width = lineWidth))
                    array.push(projections, polyline.new(hi, xloc = xloc.bar_time, line_color = c, line_style = persp == 0 ? line.style_dotted : line.style_dashed, line_width = lineWidth))

// ---------------------------------------------------------------- events (exact, DE440)
// One integer per event: minute_utc * 10000 + body * 1000 + type * 100 + detail
//   body: 0 none (eclipse), 1 Sun, 2 Mercury, 3 Venus, 4 Mars, 5 Jupiter, 6 Saturn, 7 Uranus, 8 Neptune, 9 Pluto
//   type: 1 ingress (detail = sign 0-11, +20 when retrograde), 2 station (detail 0 = turns retrograde, 1 = turns direct),
//         3 eclipse (detail 11 solar total, 12 annular, 13 hybrid, 14 partial; 21 lunar total, 24 partial, 25 penumbral)
// The table is stored as comma-separated string constants, parsed once on the first bar.
// Values stay below 2^53, so str.tonumber() returns them exactly.
EV_S01 = "105417233129,105468322201,105470421110,105563700312,105603704109,105744803201,105765110321,105797512110,105896541111,105897649200,105980825201,106080742111,106081123110,106195144110,106315242100,106327991100,106535752101,106565533111,106671817200,106707758200,106766671101,106774894111,106808952200,106965523100,106975956200,107151632201,107212571102,107343733101,107356314100,107525092102,107663731103,107712143102,107753262103,107956682104,107965644101,108074213103,108102620311,108116621104,108157139201,108208302105,108325320324,108430853104,108494105104,108567211105,108598882200,108683794102,108782613105,108888667201,108928862201,109010566201,109012151106,109017608201,109130533106,109191442106,109408394200,109441062107,109449741107,109476033107,109713662108,109820383108,109880271108,109989615200,110016132109,110164383109,110193464121,110201482200,110305871109,110360972128,110455714201,110487522201,110508633110,110640022109,110663930312,110729871110,110736754102,110854043111,110869190325,110965402110,110977716110,111155981111,111193739200,111202223100,111227152111,111455202100,111555453101,111587421100,111722755201,111773294103,111798092200,111916903102,111992317200,111998888200,112026081101,112138702201,112292083103,112405652101,112407316200,112472001102,112543394104,112681442102,112695163104,112885002103,112923191103,112998750325,113101252104,113201463105,113209860311,113263564105,113376111104,113422202105,113425280325,113455609201,113507163200,113601572200,113773002124,113797863124,113826731105,113941552201,113951184106,114087142105,114109205105,114125393201,114210497201,114271681106,114309508201,114338062106,114438416201,114463953105,114589212107,114606654107,114709251107,114875212108,114944763106,115139761108,115224612200,115230194108,115334013107,115509132201,115551930324,115565341109,115687495200,115698793108,115761050312,115825074109,115834662109,115989321110,116053943109,116119952110,116370642111,116397984110,116405203110,116415431111,116490939200,116609852100,116755173111,116798732200,116846881100,116958044111,117057522131,117105163100,117133482201,117212152100,117285571101,117291368200,117313817200,117443445201,117455813101,117516964100,117592902101,117731521102,117807183102,117819162102,117842326200,118019072103,118089564101,118097370324,118158823103,118182741103,118270312104,118317700311,118510273104,118598942200,118635691104,118696194102,118753669201,118861453105,118945742201,119086301105,119212893106,119251232105,119379654103,119480212106,119531231106,119533137201,119565313107,119600938201,119742132107,119787265106,119866556201,119919473108,119968771107,120063022108,120245892200,120276483109,120395842127,120399261108,120498774200,120532512201,120639493110,120657440321,120691252108,120824831109,120859510314,120997672109,121017543111,121248831110,121269252110,121376595200,121442773100,121516992111,121627014201,121674951111,121786589200,121808942200,121973693200,122106411100,122134642201,122481182100,122545091101,122581363201,122583008200,122633797200,122659004104,122744342101,122951332102,122991021102,122993386111,122998990314,123149235201,123165542103,123199800321,123226833101,123280636200,123442201103,123470224105,123571496130,123590082200,123653013102,123895111104,123938912201"
EV_S02 = "124040783103,124051669201,124160312104,124186304106,124345701105,124391462105,124411083104,124624382106,124770223105,124790621106,124849354107,124853987201,124892338201,124906892107,125121733106,125228171107,125264802200,125295876201,125468473107,125470494108,125486555107,125537850314,125557002201,125658671108,125759060321,125812743108,125871042108,126057944109,126084261109,126151672109,126156093109,126417852110,126499483110,126508271110,126621654110,126633436111,126683082111,126825902200,126843643111,126934421111,126973952130,127073465200,127083159200,127141102201,127173014111,127189483100,127332032111,127365881100,127538003101,127651502100,127724424100,127804561101,127875228200,127883072101,127890243102,127954867200,128086282102,128098310312,128247263103,128250481102,128288774101,128306100324,128356122103,128573882200,128610833104,128701681103,128722476200,128853075201,128865182122,128879104102,128920642201,128974012103,128984733105,129154611104,129315692104,129349909201,129378363106,129510754103,129528442105,129605241105,129775752106,129826323107,130050191106,130109312107,130175627201,130184268201,130214284104,130280832200,130337823200,130424592126,130487761107,130581662201,130644990311,130727936201,130745262107,130856840325,130918261108,130935003201,131028382108,131161745108,131205324105,131303062109,131343831109,131513514200,131571772110,131580073108,131722369108,131767801110,131803084124,131847162200,131988123109,132151872201,132193911111,132363703110,132378199200,132536152111,132625341100,132677554201,132727903111,132789185200,132789717110,132801292100,132991380324,133017542101,133064011101,133072169127,133087273100,133167358200,133196120312,133237982102,133274247200,133444423101,133509941102,133551022200,133569694105,133777027129,133800183102,133895402201,133961141103,134154393103,134168456200,134232582103,134386414106,134414101104,134451792104,134506523104,134563335201,134647289201,134668932105,134856433105,134864751105,134943672106,135076204107,135204613106,135293552200,135309731106,135475338201,135495757201,135528040325,135551883107,135605282201,135703824108,135747321107,135751520311,135898983108,135912502107,136005129108,136163516201,136177811108,136180062108,136246433109,136289974109,136456172109,136595033110,136603371109,136753262110,136775625109,136849824110,136870712200,136905137110,136946703111,136978572129,137027321110,137166182201,137305503100,137392042110,137397504111,137453411111,137673729200,137679613101,137699932111,137884831100,137942432100,137946724100,138090863102,138096100321,138144496100,138155562101,138296770314,138323501101,138459218200,138510164101,138527202200,138536745200,138594867200,138762083200,138769431102,138870632201,139098424102,139117052102,139220641103,139381753201,139382172103,139585162104,139619316200,139673591104,139719924103,139819372105,139899753103,139945529201,140124231105,140172772106,140293335201,140302672200,140345473104,140383224104,140420122125,140569201106,140626292201,140632140321,140733223105,140767688201,140805132106,140816547201,140854820314,141006791107,141063012107,141098423106,141109934105,141331562108,141437291108,141452143107,141602226201,141617882109,141800143108,141862861109,141895062200,142046504106,142145723109,142183622201"
EV_S03 = "142286821110,142309935110,142490683110,142531414200,142577932110,142712911111,142836013111,142850342111,142968379200,142975104125,142978440311,143080932100,143144351100,143182463100,143196390324,143317052101,143510412200,143530623101,143583031101,143694674201,143751878200,143799482120,143852472201,143880803102,143905452101,143913757200,144028981102,144232983103,144302052102,144316465200,144451504106,144480201103,144516412103,144587183104,144723282104,144933151104,144943963105,144994022105,145074606200,145242349201,145258024107,145304713106,145307892200,145383791105,145526440314,145642632201,145671773107,145739270321,145828761106,145914224108,145961782106,146047395201,146049853108,146058818201,146136057201,146210482107,146266351107,146453303109,146487422108,146508934109,146696881108,146819512109,146918962200,146983593110,147006062128,147044456201,147071174110,147122471109,147195213200,147203822201,147396633129,147437002109,147546461110,147620064111,147673728110,147738752110,147764925111,147785703201,147972551111,147995022111,148085680311,148171343110,148171384100,148224282100,148262609200,148293800325,148403951100,148504622200,148640183111,148738244101,148842571101,148842922201,149037163100,149043258200,149199702101,149233737200,149288451102,149330224102,149414123101,149448072102,149562076101,149648132103,149739631103,149781873102,149875122104,149952604103,150120545200,150143573103,150192551104,150308682200,150423850325,150499993104,150533566200,150540159201,150606764104,150625260312,150638538129,150643191105,150651952201,150846700325,150851643105,150869982105,151088171106,151105332106,151199533106,151293884105,151351298201,151360042107,151456057201,151525791107,151545063107,151556816120,151656022108,151826715201,151889463108,151941462200,151956341108,152026904106,152035998110,152226302201,152233533109,152381961109,152490726201,152577853110,152612442109,152805971110,152890522110,152891994107,152923373111,152966570325,153138882111,153144835100,153191140312,153232071111,153271693100,153375266101,153402502100,153509512200,153556779200,153624832131,153625193101,153627334200,153663461100,153840802201,153987173102,154064492100,154102061101,154323324126,154335918200,154363493103,154366422101,154547921102,154552027200,154582422102,154746084201,154769653104,154785782103,154999091103,155068592104,155093695101,155191194107,155298783105,155303722200,155452041104,155526940324,155549823200,155574442123,155651682201,155724252104,155728230311,155787723124,155836199201,155902711105,155924255200,155995286200,156018752105,156050094108,156168253201,156247732106,156347721106,156516722107,156552513105,156642648201,156687354109,156774937201,156776285120,156785321107,156885682108,156961792200,157018993106,157029732127,157215851108,157250362201,157266564110,157405613107,157479692108,157616785201,157641441109,157769343108,157770482109,157825814111,157941626201,158039002110,158065431110,158071630321,158123923109,158289692111,158292490314,158386244100,158427405101,158474833110,158491531111,158522872200,158824563111,158844412201,158849739200,158922951100,158962454101,159174373100,159264172100,159361601101,159511132101,159524893101,159563584102,159627168200,159714702102,159807491102,159871487200,159876153102,159943472103"
EV_S04 = "160193104103,160227753103,160258681103,160291522200,160391755102,160413320314,160579223104,160625960321,160640022201,160711631104,160834930314,160848814104,160930523105,160937822104,160979066102,161133169201,161156512105,161162291105,161282153106,161394222106,161458936200,161524994105,161607281106,161634863107,161691282107,161704925200,161934828201,161942856121,161979412200,161989383108,162044871107,162094187201,162217204106,162263682126,162275082201,162286622107,162346943109,162475391108,162645862108,162710883110,162900971109,162922832109,162930374107,162960950314,163090943111,163178610321,163188862110,163324961110,163396666201,163401785201,163501932111,163523543100,163541982200,163581572130,163696864108,163751071111,163852622201,164016683200,164134852111,164143519200,164182511100,164423542100,164621161101,164623563201,164633996102,164647282101,164854132102,164919748200,164932744200,165067041102,165189297200,165272012200,165303853101,165518181103,165520840311,165617902201,165724150324,165725243102,165829672103,165830435103,165930474201,165971061104,166081382104,166111383103,166294242105,166421671105,166428399201,166480923104,166550772106,166661914109,166839693105,166866641106,166923846200,166994042200,167191023106,167226438201,167299442201,167304261107,167367194110,167412297201,167451975200,167527132107,167537683107,167734801108,167799832108,167881913108,167974724111,168060520312,168074352109,168160411109,168225253109,168284690325,168348982110,168564502200,168565734100,168568623110,168584421110,168799382129,168855086201,168864892201,168912783111,168936802110,169010531111,169165555201,169165854101,169258623100,169314942111,169435669200,169441961100,169568842100,169607193101,169782102101,169786564102,169880601101,169959573102,170025152102,170211388200,170248092200,170316873103,170326491102,170402430325,170431034103,170508427200,170591532201,170625440312,170680963104,170777641103,170825670325,171006352103,171055893105,171095634104,171215212104,171230551104,171370405104,171437912105,171451893106,171681171105,171724149201,171732702106,171771984105,171909053107,172005382200,172126151106,172258462125,172322062201,172379143200,172385962106,172388996200,172450584106,172517978201,172563781107,172684032107,172730647201,172950892108,172959470325,172977163201,172994341108,173125464107,173164510311,173166655200,173229812109,173419941109,173588592200,173657473108,173796224108,173843931110,173880692201,174060873109,174183002110,174270001111,174316136201,174434803110,174468774109,174471642111,174554947111,174701401100,174708162100,174728789200,174798143111,174903905201,174925572101,175140031101,175156983100,175161484110,175226392200,175503658200,175509400321,175513783101,175569352201,175585921102,175725680312,175781686103,175826017200,175869323102,175911342102,175969454111,176037101103,176146972103,176223393103,176349702104,176490041104,176575453104,176577254200,176595652105,176925363105,176940681105,176996065105,177013022200,177018849201,177266267130,177273583106,177341332201,177385671106,177441464201,177581682106,177620963107,177809928201,177823281107,177832402107,177853286200,177968223108,178048097201,178056790321,178103592108,178253831108,178271290311,178315873109,178400142109,178596844100,178612812200"
EV_S05 = "178664723110,178679441109,178795957111,178802322128,178861685200,178899452201,179013022109,179016763111,179103421110,179300444101,179354602110,179376203100,179529501111,179618982111,179751723101,179778976201,179847442100,179960891100,179975794102,180020309200,180131072101,180167373102,180213872200,180303232120,180396940314,180399501101,180555062201,180617100321,180620895201,180653264103,180781742101,180795988200,180805493200,180845391102,181073272102,181145097200,181279092103,181296571103,181337304104,181425203201,181492122104,181749501104,181793982105,181979423103,182016322200,182022144105,182200131105,182232932124,182313339201,182355102201,182418163104,182466982105,182645101106,182680435106,182698354106,182730132106,182804003105,182953790314,182980172107,183082691107,183100868201,183155440321,183168393106,183263202108,183315336200,183358314107,183365707201,183513221108,183521713107,183636172200,183869503108,183920702201,183938821109,183998444108,184214963109,184221692109,184362821110,184510572110,184551285200,184559823110,184619124109,184762662111,184788921111,184905073111,184997742100,185212942200,185220331100,185223624110,185242806201,185251453100,185312439200,185498760313,185548672201,185599573101,185658971101,185722750325,185819384111,185949743102,185981542101,186088078200,186104871102,186212842102,186301983103,186325885201,186412232103,186423904100,186462757200,186556061103,186655212104,186656333104,186919506104,187009011104,187013413105,187014602200,187087924101,187360722201,187374653106,187459651105,187607669201,187642722105,187742543107,187872402106,187904631106,188033974200,188055920312,188122203108,188131952107,188258430324,188342221107,188382525107,188392998201,188443822108,188529703109,188657832200,188682597201,188772751108,188773926200,188834332127,188943852201,189031194201,189070392108,189110373110,189198351109,189236173200,189357783129,189387262109,189622351110,189660412110,189826413201,189908022111,190036044102,190048461111,190221892200,190248635200,190257993110,190396670325,190479861100,190549032201,190603489200,190604510311,190706656201,190714413111,190829394103,190865002100,190918461101,191108653100,191136282101,191345322102,191364321102,191381008200,191484413101,191555612103,191560034104,191781787200,191815461103,191851513102,191920772104,192006932200,192028215201,192093782123,192212813103,192265734105,192268381104,192355602201,192544892104,192569013104,192719031105,192784512105,192900899201,192920553105,192942510324,192948184106,193015882106,193154200312,193164031106,193268423106,193293982107,193601661107,193603584107,193613983107,193677162200,193683788201,193958423108,193968262201,193999707201,194032221108,194057235108,194228226200,194230184108,194259522108,194302533109,194457821109,194542152109,194646913110,194808852110,194830144109,194881811110,194992523111,195068002111,195237972200,195307891111,195341013100,195408924110,195424202130,195494010321,195554852201,195694803101,195701752111,195711920314,195739271100,195894329200,195969865200,195974894111,196041072100,196057353102,196169446201,196177871101,196276362101,196434883103,196479172102,196539664100,196623721102,196672918200,196733362103,196844393104,196991792200,197074861103,197099557200,197120074101,197338972201"
EV_S06 = "197406233105,197527801104,197592873200,197707952104,197741955201,197744414102,197770303124,197921412105,197978481105,198049570321,198123486105,198165622106,198194859201,198211373201,198252310314,198423511106,198485582107,198503954103,198637733105,198693602200,198861151107,198866162126,198975968201,198992992201,199092653106,199128412107,199185704200,199291701108,199316247201,199418612108,199476893107,199668115109,199677866200,199693632109,199717281109,199839623108,199852804122,199961262110,200141241110,200193663109,200219189109,200258712200,200288704201,200392750312,200544223110,200564982201,200567301111,200594060321,200770814103,200893713111,200922462111,200998681100,201184939200,201193052100,201243353100,201411072101,201437311101,201593743101,201626402102,201630006201,201721765200,201727404104,201883211102,201944923102,201966188200,201969472200,202236729128,202296483103,202314332201,202334391103,202418747200,202488214105,202620172103,202647993104,202787351104,202845482104,202931010311,202999403105,203060912105,203153500324,203190034106,203238021105,203329702106,203351213106,203474425201,203487229201,203683041106,203704193107,203706772200,203849144107,204016862201,204059113108,204120691107,204267098201,204302402107,204417253109,204470674108,204551241108,204570692108,204624649109,204633147201,204782173110,204846132109,204976841109,205060504109,205123446200,205133912110,205164353111,205195015110,205282032200,205400801110,205419362129,205492790312,205578712201,205605413100,205627154110,205698380325,205770992110,205826861111,206059973200,206089762111,206181204111,206258241100,206335152100,206474289200,206547812101,206575673131,206666073201,206696841101,206734644100,206759583100,206855092102,206945402200,207043132121,207087166201,207142711102,207258068200,207288832201,207300784101,207379873101,207491272102,207508235200,207593861103,207736617200,207774802103,207797033102,207826590325,207894564102,207978682104,208038350311,208046761104,208181683103,208209072105,208253190325,208497391105,208536754103,208538582106,208550523104,208716452200,208780489201,208874062125,208908923105,208942391106,209038342201,209191062106,209234505201,209260063106,209284524104,209380031107,209454092107,209472696106,209559028201,209606633107,209721882108,209810631108,209949577201,209950843108,210005642109,210219124200,210236271109,210294173109,210306382200,210381230324,210565046200,210589870312,210595732201,210630105111,210637553110,210660281110,210965462110,210981703111,211086361111,211241682111,211327533100,211373444201,211473722100,211517721100,211676153101,211702262101,211764239200,211777726125,211927252200,211956301101,212028653102,212269482201,212386253103,212402141102,212501867100,212540316201,212551238200,212634285100,212648514105,212691412102,212750903104,212853281103,212910322103,212925380324,213055857200,213115492104,213126923105,213146140311,213287506106,213306211104,213313755200,213377832105,213407864106,213525473106,213626147131,213722382200,213756871105,213993443107,214001295131,214055492201,214071999201,214083984107,214201891106,214353042106,214420273200,214601592107,214639551107,214708084108,214850718201,214864263126,214876632108,215016265201,215019203201,215070151108,215179533107,215193702109,215266417201"
EV_S07 = "215294294109,215330442200,215447332128,215486570321,215495781109,215615612201,215688510314,215733903108,215819652109,215855214110,215919791110,215952715100,216002636200,216128592110,216133183109,216345851111,216386932111,216403864111,216505593110,216615472100,216648507100,216777211100,216868133111,216919682200,216953314100,216987508111,217052369200,217215771101,217226463100,217258852201,217516244101,217582923101,217583582101,217661611102,217827160314,217840822102,217843228200,217865965101,217938233102,217989266201,218028130321,218041892103,218104104102,218112761103,218251580314,218264182104,218292173103,218373797200,218565721104,218644193104,218645992105,218723902200,218727224103,218752148130,218799462124,218994113105,219016411105,219066042201,219115605200,219257982105,219342403106,219364219201,219399514104,219461451106,219497492106,219689903107,219750522107,219899101107,220037313108,220042142108,220142448201,220164154105,220329681108,220353192200,220367000314,220385163109,220582997201,220587920321,220637842201,220734263110,220755301109,220808415201,221000742109,221086673111,221179301110,221227604200,221281322110,221382638111,221436186200,221446813100,221530582111,221605381111,221781412100,221823853101,221923092200,222036741100,222084822131,222244383102,222255722201,222341459200,222395884201,222436022100,222475321101,222756742101,222848743200,222921161102,222926330312,222976322102,223134630324,223135898200,223177962103,223239225102,223372291103,223434626201,223446242104,223468293201,223553124106,223693027200,223719752200,223825211104,224057833103,224067412201,224275871105,224289244107,224411122105,224490483104,224639622106,224655099201,224720891106,224874593105,224892255200,224905552107,224911546107,224930014108,225158541107,225238243106,225248582108,225373842200,225434668201,225474120311,225479822127,225519964109,225589101108,225591203107,225661682201,225685530325,225865002108,225899857201,225938783108,226014721109,226080494110,226160432109,226284113109,226430052110,226438721110,226590645201,226628344111,226628873110,226679352111,226864821111,226866666200,226935412200,226974033111,227178264100,227258442201,227296221100,227320353100,227628999200,227651172100,227668453101,227734831101,227743084101,227820070324,227903772101,228018633102,228024250312,228108412102,228180701102,228242500325,228330672103,228332794102,228370933103,228428268200,228631841103,228701805103,228708672200,228725433104,228876436201,228953624103,229011077200,229057442201,229082813105,229084761104,229327332104,229444573106,229535421105,229549572105,229609254104,229785072106,229813363107,229945829201,229980441106,230075782107,230194743108,230305854105,230356700325,230391892200,230418101107,230580460311,230606833109,230632755200,230686322201,230725908201,230848681108,231035222108,231074814106,231216467201,231274311109,231277143200,231313322109,231579352110,231698311110,231863092111,231866913201,231953832200,232043702130,232124391111,232266012201,232281754200,232295406200,232342233110,232350165201,232515842111,232555771100,232788313111,232814152100,232916919200,232924660321,232994361101,233040762101,233125230312,233180013100,233245772102,233424884201,233440191102,233554653101,233559122103,233690372200,233720398200,233833242122"
EV_S08 = "233891311103,233921133102,234036512201,234204452103,234251115104,234282063103,234314366201,234330327200,234344211104,234390254107,234474462104,234638043104,234686842105,234794861105,234939382106,234989473105,235107574108,235236029201,235239891106,235309592107,235337323106,235407022200,235460950321,235493672126,235677571107,235682923107,235683450314,235710772201,235720034109,235914692107,236018228201,236027433108,236108181108,236190262108,236289574110,236344535200,236371623109,236464732109,236533307201,236533831109,236558746108,236716083110,236736682110,236843004111,236957831110,236975942200,237061803111,237277782201,237383901111,237398514100,237410453100,237703122111,237723026200,237764553101,237807460311,237815251100,237961042100,237969864101,238024800324,238085135201,238127683102,238175312101,238204379200,238253821101,238407602102,238506523103,238566404102,238666682200,238699651102,238919733104,239010342201,239013368200,239054766127,239150781103,239192134103,239396922103,239543183105,239603701104,239608942104,239636093200,239648697200,239726073124,239748526201,239829152105,239846124104,239881915105,240054371105,240115042106,240254733201,240354540314,240418902200,240424096108,240499411106,240524584105,240525179201,240568070321,240720893105,240733782201,240937071107,241074662107,241166113106,241227414106,241309188201,241341432108,241367651108,241548153107,241619142109,241793281109,241849887201,241909963108,241950202110,241971924107,241999852200,242037295200,242046962129,242217271110,242263523109,242293102201,242567232110,242613773110,242643341111,242862232111,242871894108,242914770311,242963043111,243074701100,243100992100,243122270325,243149166200,243312503100,243316292101,243482454200,243491169200,243513291101,243643992200,243662763101,243799245201,243959161102,243987212201,244013853102,244059514127,244295622102,244305378200,244365393103,244410341103,244540442103,244540554201,244716943104,244742872104,244863301104,244968347200,244983782105,245026694108,245068473105,245179936201,245313981105,245420473106,245427042200,245453470312,245569985106,245675340325,245753712201,245759011106,245773713107,245814949201,245827274109,245971162106,246129013108,246196661107,246223662107,246445114110,246487743109,246493602108,246601408201,246627221108,246785582109,246853713110,247023234111,247024152200,247052841109,247166757201,247238273111,247256572128,247311442201,247371632109,247476841110,247596994100,247689513100,247726645200,247743352110,247795640325,247902911111,248010672111,248020130312,248103093200,248184344101,248239872100,248334291100,248496912101,248529853131,248574846200,248629952200,248708613201,248772871101,248778449200,248784972120,248795124102,248897533100,248971542201,249151272101,249218711102,249432164103,249455673101,249464552102,249502705201,249598728200,249669841103,249673172103,249868913102,249883402104,250092204104,250122751104,250171012105,250252143103,250287167200,250355000324,250431012200,250556660311,250573401105,250609726201,250620303104,250698882124,250767354105,250768502201,250835322105,250978353105,251018421106,251102959201,251122022106,251273605107,251329313106,251371192107,251449494106,251456071107,251651592108,251675783107,251886651108,251892408201,252019943108,252047742200"
EV_S09 = "252134994107,252290896109,252312281109,252332312201,252363263109,252483447201,252607892109,252706643110,252736291110,252828564108,252900900321,252900992110,253050803111,253121310314,253154682111,253162381111,253386942100,253396653100,253427875200,253550804109,253593751100,253627392200,253745343101,253964012201,254001556200,254032331101,254064169200,254098003102,254369202101,254399587101,254407754110,254455913103,254478151102,254606292102,254805602103,254821143104,254890778200,254929271103,255007714200,255041562104,255198323105,255206965201,255241810314,255382201104,255430222200,255453820321,255599673106,255607287200,255663460314,255687744129,255775452201,255832891105,255896404201,256033592105,256038336201,256080853107,256104564110,256264592106,256277941106,256391949201,256461053200,256522002107,256715621107,256826782108,256835823126,256921777120,256946795108,257053414111,257060943201,257069732200,257146221108,257184188201,257277122127,257295023107,257355232201,257443032108,257571831109,257718204100,257776602109,257789810314,257800467201,257809983108,257995801110,258007920321,258051492110,258205493109,258299312111,258356914101,258421841111,258576453110,258634992200,258643487101,258853181100,258938233111,258963602201,259002124102,259151955200,259246812100,259291751101,259296113100,259350869200,259430026200,259527852101,259652263101,259662694103,259737591102,259739322102,259946452103,260007373102,260184258200,260188741103,260265792104,260337194104,260349230311,260361183103,260423552200,260552110324,260586662123,260641701104,260713143104,260771992201,260921655201,260925462104,260926837200,261017584105,261063063105,261092421105,261177482105,261407542106,261411433106,261465396201,261537501106,261679359201,261681742107,261693824106,261759063107,261975201107,262089412200,262106653108,262358204107,262379522201,262405791108,262454683109,262475678201,262551805109,262647422108,262804023110,262831391109,262889580312,262932552109,263007374108,263113900325,263117547201,263156793111,263199912110,263255351110,263454972111,263517623100,263642134109,263650142200,263681371111,263886682130,263896273101,263968692201,264057432111,264112701100,264141596110,264266234110,264322313102,264430082100,264551251101,264635999200,264669532101,264860256200,264872382102,264890574111,264892053200,264910575200,264997091102,265114892103,265230850325,265409382200,265448241103,265453600312,265476708200,265511323201,265551454100,265607776129,265653900325,265757072201,265901171104,266099722104,266135613103,266247527200,266314502105,266351851105,266555862106,266562823104,266614924200,266659465201,266796911106,266865412107,266891986201,266945283105,266967359201,267106252200,267234601107,267308132126,267308213106,267404302201,267507552107,267552334201,267660823107,267665201108,267767078201,267788230325,267808712108,267993730311,268008213108,268030246110,268063875110,268084272109,268090821109,268328674101,268351202110,268353413109,268434937201,268514801110,268670322200,268698053110,268940841111,268978132201,269043113111,269138104102,269307862111,269372171100,269389363100,269584612100,269737423101,269804692101,269810731101,269863094103,269921569200,270016092102,270087613102,270157565111,270256571102,270292636200,270337990321,270387932200"
EV_S10 = "270439993103,270553620312,270569744104,270699725200,270707721103,270733222201,270769988200,270794673104,271005952103,271152373105,271160661104,271239122104,271246025130,271265134105,271453172105,271514673106,271567887200,271611351105,271716702106,271884393107,271944144106,272056411106,272119902200,272254669201,272267613108,272319566201,272422135201,272428372201,272494111107,272600614107,272684843109,272691952107,272885430324,272924741108,272961362108,273059188201,273100530311,273231534108,273236322109,273318353200,273350391109,273458505111,273517902110,273693412200,273752597201,273774391110,273838134109,273861052129,273907713201,273991332201,274145942110,274200431111,274424634110,274424703110,274479322111,274631731100,274727852100,274861983111,274940492101,274998664111,275070241101,275206259200,275211832102,275225210314,275251303100,275363882200,275370825100,275445720321,275516031102,275544752121,275572374100,275624863101,275707222201,275728636200,275855672102,275967141103,275990743102,276062728200,276166844101,276167052103,276351323103,276372352104,276420071104,276506195200,276599382105,276707103104,276830364102,276870761105,276889137200,276912632106,277058453105,277130182200,277315841106,277322442125,277406293106,277450282201,277541429201,277574312106,277748906201,277751923107,277753561107,277782600314,277822305131,277845222107,277855914200,277984190321,278096493108,278112422108,278184201108,278207355201,278350388201,278394082109,278440743109,278591135100,278609881109,278717722200,278785303110,278926114201,279007932201,279033901110,279070647201,279131133111,279352422110,279459941111,279479963100,279632922111,279699356111,279834343101,279866642100,279891241100,279929039110,279957454103,280089822101,280198073102,280327370313,280329741101,280344352200,280490369200,280551230325,280578253103,280686772201,280709605101,280766114104,280775491102,280995463104,281079369129,281079872102,281169016200,281226581103,281304242103,281355398200,281498204105,281508112104,281679343200,281679501104,281763312105,282130211105,282136792200,282190404106,282210247200,282298433201,282305615200,282468212201,282575301106,282744092106,282802313105,282828499201,282847244107,282884400312,282992892107,283013011107,283087340324,283179906201,283239313106,283266252108,283443631108,283470154108,283573522109,283619313107,283642878201,283741892200,283869271109,283885372128,283980243108,283998205201,284027482201,284063384109,284200092109,284293271110,284299769110,284333303109,284389107201,284518302110,284634054110,284683253110,284719331111,284778892111,285007232100,285032303111,285150661100,285191874111,285225130325,285334942200,285381603100,285433370311,285589201101,285674952201,285731713101,285748534100,285774919200,285965452101,286035001102,286082703102,286113155102,286233372102,286317954101,286434203103,286435872103,286486111103,286613656200,286648528200,286654102104,286785793104,286918034102,286939041104,286991222105,287137433105,287138962200,287280152124,287389751105,287479952201,287489633106,287532027200,287539189129,287579864103,287644102105,287771240324,287834841106,287843163107,287889692106,287982450312,288075605200,288114099201,288141232107,288198883108,288272551107,288429182108,288448904104,288558263109,288613126201"
EV_S11 = "288674799110,288703161108,288764832200,288921204200,288925333110,288934148201,289049372201,289128811109,289312443111,289360044123,289388702109,289552801110,289672132110,289707977201,289775973100,289776755201,289922462111,289978871111,290060394201,290145983200,290165442100,290322590321,290336862200,290410211100,290510813131,290540870314,290550182131,290555988100,290670692201,290751043201,290797452100,290825014104,290848761101,291005563100,291057919200,291146552101,291294551102,291357366100,291370192102,291530833101,291570582103,291583825103,291691564105,291745621103,291827492104,291940513102,291940628200,291979077102,292062116200,292135652200,292198491104,292322373103,292420434106,292482902201,292649141105,292689873104,292785666131,292803232105,292853737200,292878120321,293031662106,293047593105,293080620314,293087954107,293094191106,293294812107,293398393106,293400509201,293521118131,293531911107,293622622108,293710214108,293744803107,293761407121,293785812200,293812625200,293920402127,293962561108,294049796201,294072992201,294088943108,294226628201,294248802108,294297344109,294388231109,294432263109,294550312109,294775633110,294812251110,294821212110,294859974110,294908158100,295027357201,295069682111,295119793111,295171326100,295221720312,295238321111,295348082200,295410164111,295422940321,295465663100,295533135201,295669661100,295672542201,295814413101,295960564100,296037212100,296108191101,296167233102,296194127102,296296172101,296342029200,296502262102,296523854101,296525453103,296553971102,296719162103,296891273104,297005051103,297112494102,297125752200,297133125104,297233928200,297269623105,297457931104,297474592201,297514626200,297673933106,297715482104,297739514103,297759460311,297908591105,297942642105,297981730324,298171273107,298175867200,298176212106,298353651106,298427294104,298461442107,298501953200,298685189201,298791381107,298804332200,298819903126,299097552201,299102723201,299222031108,299274974105,299395333107,299424332108,299490756201,299517998201,299519905200,299647701109,299703822109,299885333108,299930864200,299970062110,300071701110,300240862111,300277513109,300321600312,300346907201,300365762200,300492162130,300497731111,300527530325,300536534124,300647123110,300679532201,300894022111,300929051100,301008173111,301098034201,301204402100,301263625201,301365573100,301367581101,301434182101,301624699200,301637982102,301717674105,301721423101,301813381102,301920672103,302076333102,302108552200,302264511103,302332392122,302430023103,302455012201,302525848200,302566682103,302605004106,302654430325,302717451104,302762895105,302781913104,302866870311,302867322104,302971306200,303079632105,303081140325,303131833105,303168141105,303308324107,303328572106,303480253106,303498327200,303613221106,303672702107,303819972200,303827993107,303940344108,303945362126,303970449201,304050931107,304122112201,304175753108,304301062107,304481561108,304523993109,304527984109,304580642108,304810038201,304855182109,304873603110,304907221109,304935806201,305088024110,305125182110,305210530324,305212565200,305226803111,305331221110,305387422200,305418680312,305588413100,305635524111,305667177201,305690782201,305757261111,305968813101,306090672111,306184564100,306188571100,306353082100,306401083102"
EV_S12 = "306535006101,306568682101,306627091101,306747814101,306793022102,306908019200,306935423200,306976665201,307072901102,307085232200,307335804102,307429272201,307524021103,307554183201,307753400324,307786582103,307819258200,307956104103,307974560311,307976941104,308002712104,308212463103,308220702105,308427611105,308431816200,308451085106,308499082106,308615164104,308634783104,308820917200,308832342200,308872651106,309015683105,309145482201,309254779201,309310331107,309327104105,309377923106,309465042107,309730183107,309732002108,309740941108,310008722109,310077393108,310101658201,310166601109,310166864106,310314492110,310315720321,310384616201,310411172200,310422473109,310500142129,310517530314,310590611110,310705612201,310767033110,310903205200,310949922110,310958464200,310987407201,311016681111,311112033111,311252552111,311448021100,311458243100,311493792100,311707722101,311710294125,311806263101,311886561101,312061852200,312116954201,312156463102,312190859200,312332361102,312405222201,312508913103,312554894106,312655250314,312677262102,312679805201,312783481103,312856420321,312863773104,312933612103,313079760314,313111518200,313136172104,313221813105,313236421104,313372552105,313468834107,313584663106,313687121105,313748612106,313840982200,313895426200,313926592125,313955343107,314132191106,314140944108,314144237200,314154245107,314166022201,314340473108,314359612106,314538769201,314569881107,314614842107,314741124109,314763393109,314883692108,315000491108,315172072109,315196230314,315305654110,315359883200,315393138201,315416820321,315426141109,315435502200,315723462201,315837276201,315850141110,315855874111,315948963201,316131632110,316276201111,316308517201,316402202111,316408274100,316505313110,316606515200,316632422100,316707521100,316874872101,316935193111,316976074101,317046332200,317146041101,317269042120,317322373100,317388162201,317472959200,317506502101,317568884102,317591811102,317694933101,317751946102,317754280312,317855112102,317963130324,318042911103,318060233102,318067162103,318191604103,318275032104,318384795201,318404748200,318420463103,318495851104,318551342105,318776043104,318844764104,318845612200,318946561105,319127303105,319181682201,319360646200,319391671106,319467417200,319475143106,319513702106,319527424105,319762232107,319820803107,319823009201,319823545108,319829411107,320040312108,320165413108,320246354106,320260051108,320303300311,320387072109,320459272200,320509723109,320514280325,320524312128,320685168201,320685701109,320743952201,320854343110,320992992109,321047284107,321109681110,321200293111,321291152110,321293956201,321535711111,321546622111,321549303100,321629497201,321777012100,321904023101,321967011100,322042042200,322085024200,322268413102,322336295200,322379562201,322405511101,322648710325,322650063103,322755602101,322755899200,322851281102,322852350312,322999432102,323071040325,323071773104,323186314201,323199092103,323302371103,323429052104,323697508200,323722283200,323755301104,323845672200,324103555201,324189892201,324206031105,324235284108,324341993201,324423562105,324651151106,324656752106,324791697200,324826256200,324882333105,324901074109,324912192107,325088891107,325105899201,325185460325,325211152108,325312193106,325409460313,325417505109"
EV_S13 = "325481552200,325489774110,325519531108,325690293107,325745762127,325766642201,325788222108,325945161109,325976178201,326050373108,326053964111,326165542109,326369111110,326402963109,326442412110,326618004100,326690742111,326752613110,326754076201,326795121111,326951527201,326967192100,327048222200,327101443111,327133072131,327197154101,327226421100,327378302201,327450583100,327557395110,327625882100,327664941101,327753140321,327800583101,327800854102,327918962101,327953660312,328037219200,328098025200,328110751102,328133252102,328151503102,328337832103,328432264103,328503003103,328561891103,328631972104,328644565129,328839932200,328854643104,328897366103,328990428200,329014851104,329066002123,329088834104,329188132201,329195037103,329206403105,329297872104,329465581105,329558803106,329570212105,329763924105,329799242106,329843575201,329910711106,329912633107,330069892107,330115647200,330268803108,330289820321,330291016200,330348461107,330389919201,330451584106,330476132108,330501572200,330512130314,330525982127,330628843109,330779111108,330790812201,330899725110,330997083110,331034452108,331074197122,331152474107,331204761109,331268448201,331322752109,331386953111,331590922110,331628731110,331843242111,331865673100,331883524108,332054741111,332062402200,332188623200,332216926201,332273307201,332382582201,332486031100,332499493131,332636410311,332730514109,332793293201,332818382100,332853130321,332855255111,332924531101,333062492101,333102733100,333265772102,333319499200,333370311102,333396777103,333460554200,333499102103,333605493101,333821411103,333826852200,333890835200,334011973102,334175002201,334274331104,334283708200,334341944128,334392603103,334419804201,334490712104,334498084109,334707552105,334725021105,334759493104,334946292106,335029485130,335116893105,335170121106,335182730314,335247442107,335396950321,335440947200,335467523106,335518832200,335533124110,335607881107,335610485201,335672439201,335753806200,335757672126,335813853107,335815602201,335876742107,336038561108,336157973108,336175304111,336181555111,336198512108,336464261109,336474842109,336501313109,336559458201,336741352110,336781954100,336844693110,336888271110,337082022200,337188833111,337314301111,337391352201,337391644101,337534713100,337596457201,337681046201,337691932111,337743780311,337745581100,337883523101,337950660325,337975812100,338018894102,338184041101,338198262101,338204205100,338236503102,338406632102,338595053103,338600459200,338629771102,338667864103,338806432200,338961493104,339080841103,339152052201,339335314104,339341143105,339388932103,339533761104,339576238200,339632532104,339697795200,339748753106,339845542105,339984481105,340012624105,340043266104,340104332106,340267383107,340281780312,340429601106,340504060324,340533002200,340542983200,340690044106,340765637200,340805203126,340839832201,340867361107,340955629201,341080852107,341144453201,341214096200,341298051108,341351912108,341360564107,341396565201,341488843107,341626552109,341723741109,341851838201,341903682110,341960403108,342022214108,342104842200,342147741110,342308982129,342349493109,342404062201,342512722110,342530156123,342573761111,342624650325,342677984109,342717833110,342849050312,342868362111,342919117201,343005031100,343078163111"
EV_S14 = "343120332100,343145106201,343333422101,343336564110,343435123100,343443491101,343580975101,343585052102,343754856104,343782402200,343790663101,343881489200,343889231102,344029284111,344061932121,344125752201,344145373102,344187922102,344340331103,344498933103,344558772103,344766062104,344793291104,344850783104,344869768200,344990082105,345130704200,345183110324,345200733105,345244041105,345290912106,345385160311,345492815200,345543882200,345549243106,345689191106,345771782125,345862142201,345897133107,345952092106,346008264201,346091957200,346126961107,346236182107,346238209201,346245063108,346502932108,346557631108,346593513109,346671096200,346691784100,346782872109,346943403110,346983311109,347129042200,347143318201,347186115201,347297043111,347407311110,347420232201,347490754101,347659463100,347730120321,347738432110,347833341111,347950060314,348023882111,348041743101,348193574102,348243567201,348259512100,348264631100,348478892101,348481143102,348608256201,348703111101,348761582200,348883704103,348979193200,348992925102,349104312201,349148851102,349162519200,349467062102,349574374104,349597353201,349599921103,349698022103,349900962104,350052831104,350070310314,350149962105,350161838200,350262434105,350281710321,350288773103,350492050314,350503521105,350551082200,350706723104,350880812201,350939574106,350948631106,351086193105,351134612106,351259625200,351292556105,351384162107,351386391107,351417297200,351447813106,351520219201,351598234107,351656002108,351799773107,351817051108,351956202109,352124026200,352146813108,352153262200,352234814108,352242731109,352324292128,352435478201,352439382201,352491763109,352576732109,352618680314,352666741110,352836233110,352837200321,352849884109,352907662110,352962855201,352991266124,353092791111,353170722111,353181153111,353399282100,353446834110,353524101100,353527303100,353567427201,353731442101,353750452200,353769762120,353875303101,353962601101,354032844111,354069476201,354091172201,354225513102,354344262101,354408351102,354442399200,354457335103,354578033103,354622234100,354625472102,354829912103,354859421103,354933063104,355044612104,355091116105,355177590311,355247234101,355291433105,355312331104,355357292105,355380090324,355455228200,355553852200,355654863106,355742962124,355763021105,355893682201,356026583107,356026982105,356052294102,356208131106,356281792106,356413833108,356500174200,356532072107,356645901107,356744317200,356802749201,356816802108,356843393109,356936194121,356991275200,357076581108,357176412200,357401273200,357460932201,357502281109,357527134201,357572246200,357718660312,357727398201,357776122109,357926291110,357943090325,357990223201,358062822110,358157134102,358314412111,358352321111,358552162100,358585133110,358714555201,358750872200,358783611100,358893177201,359008433111,359038174103,359057482131,359085732201,359114362100,359222091101,359393573100,359528296201,359535612101,359667831102,359683338101,359723369200,359763912102,359765143101,359789184104,359963532103,359994865104,360059240325,360118891103,360129893102,360211192104,360281720312,360482150325,360489773103,360502884105,360551392200,360571801104,360747198200,360845143104,360898102201,361022501105,361188654106,361195012105,361196313105,361423842106,361467621106"
EV_S15 = "361544133106,361684462107,361844764107,361879458120,361889833107,361905411107,362001582108,362070187200,362083639201,362197762200,362234523108,362259215105,362336111108,362358542127,362470264108,362484312201,362578923109,362617040325,362630212108,362697405200,362761821109,362822990311,362923663110,362940052109,363015436200,363019138201,363067924109,363133755124,363185841110,363212402110,363269723111,363460472111,363611861111,363618923100,363643664110,363760922200,363973973101,364043121100,364086802201,364087578101,364206234111,364218207201,364339053102,364422002100,364443845201,364481581101,364688292101,364722263103,364767294100,364896222102,364927311102,364984056201,365002929200,365108712103,365148953104,365166530324,365342114101,365378371103,365381520312,365542672200,365616255105,365765153200,365831281104,365891472201,365953784102,366039637104,366040308200,366101782104,366281991105,366335782105,366385383201,366474756106,366567652106,366657294103,366727101106,366848102107,366961303105,367164851107,367216752200,367365479201,367384933106,367397647200,367508792201,367595521108,367615574200,367714150324,367761273107,367813132108,367890055106,367929830311,368021211109,368094342109,368120593108,368311418201,368360982110,368388185200,368445211110,368454346200,368472773109,368623962111,368733494201,368777792200,368822153110,368871241111,368888155125,368939772130,368961347123,369093212201,369170793111,369268032111,369302521100,369519763100,369545127201,369594332100,369741001101,369827592101,369869623101,369928874104,370030712102,370053420314,370122177104,370154175201,370186761102,370220463102,370274250321,370283359200,370294022103,370435936201,370526592200,370571933103,370637861103,370716424105,370873432201,370923623104,371090811104,371259922104,371275503105,371302835106,371332678200,371426764106,371472622105,371541531105,371628093106,371718292106,371982213107,371986651106,372045832107,372088904107,372232852200,372338803108,372388732126,372424401107,372533462201,372611480314,372646049201,372685772107,372699543109,372710924108,372724007200,372813030321,372855061108,372971002108,373069033110,373245772109,373280731109,373300104109"

var int[] EV = array.new_int(0)
if barstate.isfirst
    for chunk in array.from(EV_S01, EV_S02, EV_S03, EV_S04, EV_S05, EV_S06, EV_S07, EV_S08, EV_S09, EV_S10, EV_S11, EV_S12, EV_S13, EV_S14, EV_S15)
        for item in str.split(chunk, ",")
            array.push(EV, int(str.tonumber(item)))
    array.push(EV, 99999999990000)   // sentinel (type 0, never shown): no read past the end of the table

BODY_NAMES = array.from("", "Sun", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto")
BODY_GLYPHS = array.from("", "☉", "☿", "♀", "♂", "♃", "♄", "♅", "♆", "♇")
SIGN_NAMES = array.from("Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces")
SIGN_GLYPHS = array.from("♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓")

evTime(int v) =>
    int(math.floor(v / 10000)) * 60000

// Line id (0-8) of an event body (1-9): the body toggles above also filter the events.
evSelected(int body) =>
    evAll or body == 0 or isOn(body == 1 ? 2 : body == 2 ? 0 : body == 3 ? 1 : body - 1)

evShown(int v) =>
    int typ = int(math.floor(v / 100)) % 10
    int body = int(math.floor(v / 1000)) % 10
    (typ == 1 and evIngress or typ == 2 and evStation or typ == 3 and evEclipse) and evSelected(body)

evShort(int v) =>
    int typ = int(math.floor(v / 100)) % 10
    int body = int(math.floor(v / 1000)) % 10
    int det = v % 100
    string s = ""
    if typ == 1
        s := array.get(BODY_GLYPHS, body) + "→" + array.get(SIGN_GLYPHS, det % 20) + (det >= 20 ? "℞" : "")
    else if typ == 2
        s := array.get(BODY_GLYPHS, body) + (det == 0 ? " ℞" : " D")
    else
        s := det < 20 ? "☉ eclipse" : "☽ eclipse"
    s

pad2(int n) =>
    (n < 10 ? "0" : "") + str.tostring(n)

utcStamp(int t) =>
    str.tostring(year(t, "UTC")) + "-" + pad2(month(t, "UTC")) + "-" + pad2(dayofmonth(t, "UTC")) + " " + pad2(hour(t, "UTC")) + ":" + pad2(minute(t, "UTC"))

evLong(int v) =>
    int typ = int(math.floor(v / 100)) % 10
    int body = int(math.floor(v / 1000)) % 10
    int det = v % 100
    string s = ""
    if typ == 1
        s := array.get(BODY_NAMES, body) + " enters " + array.get(SIGN_NAMES, det % 20) + (det >= 20 ? " (retrograde)" : "")
    else if typ == 2
        s := array.get(BODY_NAMES, body) + (det == 0 ? " stations retrograde" : " stations direct")
    else
        string kind = det % 10 == 1 ? "total" : det % 10 == 2 ? "annular" : det % 10 == 3 ? "hybrid" : det % 10 == 4 ? "partial" : "penumbral"
        s := (det < 20 ? "Solar" : "Lunar") + " eclipse (" + kind + ")"
    s + "\n" + str.format_time(evTime(v), "yyyy-MM-dd HH:mm", "UTC") + " UTC, exact (DE440)"

var int evIdx = 0
int barEnd = na(time_close) ? time + (time - nz(time[1], time - 86400000)) : time_close
if barstate.isfirst
    while evIdx < array.size(EV) ? evTime(array.get(EV, evIdx)) < time : false
        evIdx += 1

string shortTxt = ""
string longTxt = ""
bool hasIngress = false, bool hasStation = false, bool hasEclipse = false
while evIdx < array.size(EV) ? evTime(array.get(EV, evIdx)) < barEnd : false
    int v = array.get(EV, evIdx)
    if evShown(v)
        shortTxt += (shortTxt == "" ? "" : "\n") + evShort(v)
        longTxt += (longTxt == "" ? "" : "\n\n") + evLong(v)
        int typ = int(math.floor(v / 100)) % 10
        hasIngress := hasIngress or typ == 1
        hasStation := hasStation or typ == 2
        hasEclipse := hasEclipse or typ == 3
    evIdx += 1

if shortTxt != ""
    label.new(bar_index, high, shortTxt, yloc = yloc.abovebar, style = label.style_label_down, size = size.small,
         color = hasEclipse ? color.new(#111111, 10) : hasStation ? color.new(#6f42c1, 15) : color.new(#3d6fd9, 25),
         textcolor = color.white, tooltip = longTxt)
plotshape(hasEclipse, "Eclipse", shape.diamond, location.belowbar, color.new(#111111, 0), size = size.tiny)
plotshape(hasStation, "Station", shape.triangleup, location.belowbar, color.new(#6f42c1, 0), size = size.tiny)
plotshape(hasIngress, "Ingress", shape.circle, location.belowbar, color.new(#3d6fd9, 0), size = size.tiny)

// Upcoming events inside the projection window, at their exact time on the future axis.
var label[] upcoming = array.new<label>()
if barstate.islast
    while array.size(upcoming) > 0
        label.delete(array.pop(upcoming))
    if evFuture and projectDays > 0
        int horizon = time + horizonMs
        int j = evIdx
        while (j < array.size(EV) ? evTime(array.get(EV, j)) < horizon : false) and array.size(upcoming) < 60
            int v = array.get(EV, j)
            if evShown(v)
                array.push(upcoming, label.new(evTime(v), close, evShort(v), xloc = xloc.bar_time, yloc = yloc.price,
                     style = label.style_label_down, size = size.small, color = color.new(#888888, 30),
                     textcolor = color.white, tooltip = evLong(v)))
            j += 1

// ---------------------------------------------------------------- positions table
fmtPos(float deg) =>
    float d = mod360(deg)
    int s = int(math.floor(d / 30))
    float within = d - 30 * s
    int dd = int(math.floor(within))
    int mm = int(math.floor((within - dd) * 60))
    str.tostring(dd) + "°" + (mm < 10 ? "0" : "") + str.tostring(mm) + "' " + array.get(SIGN_GLYPHS, s)

var table posTable = na
if showTable and barstate.islast
    if not na(posTable)
        table.delete(posTable)
    string where = tablePos == "top right" ? position.top_right : tablePos == "bottom left" ? position.bottom_left : tablePos == "top left" ? position.top_left : position.bottom_right
    posTable := table.new(where, 3, 12, bgcolor = color.new(color.black, 80), border_width = 0)
    table.cell(posTable, 0, 0, "", text_color = color.gray, text_size = size.small)
    table.cell(posTable, 1, 0, "Geo", text_color = color.gray, text_size = size.small)
    table.cell(posTable, 2, 0, "Helio", text_color = color.gray, text_size = size.small)
    for id = 0 to 8
        // rows in the usual order: Sun first
        int b = id == 0 ? 2 : id <= 2 ? id - 1 : id
        float g = geoLon(b, Tbar)
        bool retro = b != 2 and wrap180(geoLon(b, Tbar + 1.0 / 36525.0) - g) < 0
        string name = b == 2 ? "☉ Sun / Earth" : array.get(BODY_GLYPHS, b < 2 ? b + 2 : b + 1) + " " + array.get(BODY_NAMES, b < 2 ? b + 2 : b + 1)
        table.cell(posTable, 0, id + 1, name, text_color = bodyColor(b), text_size = size.small, text_halign = text.align_left)
        table.cell(posTable, 1, id + 1, fmtPos(g) + (retro ? " ℞" : ""), text_color = color.white, text_size = size.small)
        table.cell(posTable, 2, id + 1, fmtPos(helioLon(b, Tbar)), text_color = color.silver, text_size = size.small)
    table.cell(posTable, 0, 10, "Positions: approximate (max error 11')", text_color = color.gray, text_size = size.tiny, text_halign = text.align_left)
    table.merge_cells(posTable, 0, 10, 2, 10)
    table.cell(posTable, 0, 11, "Events: exact to the minute (DE440)", text_color = color.gray, text_size = size.tiny, text_halign = text.align_left)
    table.merge_cells(posTable, 0, 11, 2, 11)

Overview

Celestial Events & Planetary Lines calculates planetary longitudes using Keplerian orbital elements and converts planetary degrees into price levels based on a customizable price-per-degree ratio. The indicator flags astronomical events including sign ingresses, stations, and eclipses derived from NASA JPL DE440 ephemeris data. It also features a real-time celestial positions dashboard table. Users can select individual planets, adjust degree step increments, and project lines forward into future bars.

Details

Published by

aidatatools-dev on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Geocentric linesbooltrueshowGeo
Heliocentric linesboolfalseshowHelio
Price per degree (0 = auto)float0.0unitIn
A line every (degrees)int360stepDeg
Project lines forward (days, 0 = off)int60projectDays
Line widthint1lineWidth
Sun (geo) / Earth (helio)booltruebSun
MercuryboolfalsebMer
VenusboolfalsebVen
MarsbooltruebMar
JupiterbooltruebJup
SaturnbooltruebSat
Show all 24 settings
SettingTypeDefaultVariable
UranusboolfalsebUra
NeptuneboolfalsebNep
PlutoboolfalsebPlu
Mean of 5 (Jupiter..Pluto)boolfalsebM5
Circle of 8 (Mercury..Pluto)boolfalsebC8
Sign ingressesbooltrueevIngress
StationsbooltrueevStation
EclipsesbooltrueevEclipse
Events for every body (not only the selected ones)boolfalseevAll
Show upcoming events (within the projection window)booltrueevFuture
Positions tablebooltrueshowTable
Table positionstringbottom righttablePos
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

575 stars

This overlay indicator scans a pasted list of symbols for ICT liquidity sweep patterns using prior swing sweeps. The screening method looks back one, two, or three swings and can list long and short signals in a results table with adjustable rows, position, an

Indicator v5 SMC / ICT / price actionScreeners & dashboards
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Liquidity Sweep Pattern Scanner
368 stars

This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale

Indicator v5 Support & resistanceScreeners & dashboards
Updated 3 months ago · None stated GitHub repository of Multi Alert Long/Short [Alorse]

BZ-tracker

by Allen1212
302 stars

The BZ-tracker indicator marks ARK Invest buy and sell transactions on stock charts with labels. It plots green labels for purchases and red labels for sales, each annotated with a multiplier such as X1 or X2 to show the number of ARK ETFs trading the stock on

Indicator v4 Support & resistanceScreeners & dashboards
Updated 3 years ago · None stated GitHub repository of BZ-tracker
257 stars

This indicator overlays an intraday SPX and ES chart with a midnight session range, regular-trading-hours opening levels, and a VWAP projection box. It draws the midnight high, mid, and low, flags edge rejections within an absolute tolerance, and plots optiona

Indicator v6 TrendSupport & resistance
Updated 2 months ago · None stated GitHub repository of SPX Midnight Box + Snag Logic

Golden Bullet Strategy

by TradersPost
228 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 4 months ago · None stated GitHub repository of Golden Bullet Strategy

More Support & resistance scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers