PINE LIBRARY

AstroLib

Updated
Library "AstroLib", or Astro Library, is a collection of public Pinescript functions & calculations for use in astrology & astronomy indicators. Unless noted otherwise, this library was written jointly by badsector666 and @BarefootJoey.

Library "AstroLib"

t_(txt)
  Parameters:
    txt (string)

JDNv2(t, withFraction)
  Parameters:
    t (float)
    withFraction (bool)

J2K(t)
  Parameters:
    t (float)

J2KtoUnix(TimeInJDN)
  Parameters:
    TimeInJDN (float)

atan2(y, x)
  Parameters:
    y (float)
    x (float)

DegSin(x)
  Parameters:
    x (float)

DegCos(x)
  Parameters:
    x (float)

DegTan(x)
  Parameters:
    x (float)

DegArcsin(x)
  Parameters:
    x (float)

DegArccos(x)
  Parameters:
    x (float)

DegArctan(x)
  Parameters:
    x (float)

DegAtan2(y, x)
  Parameters:
    y (float)
    x (float)

range2pi(x)
  Parameters:
    x (float)

range360(x)
  Parameters:
    x (float)

gst(days)
  Parameters:
    days (float)

DegDecimal(Degrees, Minutes, Seconds)
  Parameters:
    Degrees (float)
    Minutes (float)
    Seconds (float)

Rectangular(R, theta, phi, Index)
  Parameters:
    R (float)
    theta (float)
    phi (float)
    Index (float)

rLength(x, y, z)
  Parameters:
    x (float)
    y (float)
    z (float)

spherical(x, y, z, Index)
  Parameters:
    x (float)
    y (float)
    z (float)
    Index (float)

obliquity(d)
  Parameters:
    d (float)

requatorial(x, y, z, d, Index)
  Parameters:
    x (float)
    y (float)
    z (float)
    d (float)
    Index (float)

recliptic(x, y, z, d, Index)
  Parameters:
    x (float)
    y (float)
    z (float)
    d (float)
    Index (float)

sequatorial(R, theta, phi, d, Index)
  Parameters:
    R (float)
    theta (float)
    phi (float)
    d (float)
    Index (float)

secliptic(R, theta, phi, d, Index)
  Parameters:
    R (float)
    theta (float)
    phi (float)
    d (float)
    Index (float)

precess(d1, d2, DEC, RA, Index, ddec, dra)
  Parameters:
    d1 (float)
    d2 (float)
    DEC (float)
    RA (float)
    Index (float)
    ddec (float)
    dra (float)

riset(J2000, DEC, RA, GLat, GLong, Index)
  Parameters:
    J2000 (float)
    DEC (float)
    RA (float)
    GLat (float)
    GLong (float)
    Index (float)

ssun(d, Index)
  Parameters:
    d (float)
    Index (float)

rsun(d, Index)
  Parameters:
    d (float)
    Index (float)

sun(d, Index)
  Parameters:
    d (float)
    Index (float)

SunLongitude(d, Index)
  Parameters:
    d (float)
    Index (float)

Sunrise(J2000, GLat, GLong, Index, altitudex)
  Parameters:
    J2000 (float)
    GLat (float)
    GLong (float)
    Index (float)
    altitudex (float)

smoon(dx, Index)
  Parameters:
    dx (float)
    Index (float)

rmoon(d, Index)
  Parameters:
    d (float)
    Index (float)

tmoon(d, GLat, GLong, Index)
  Parameters:
    d (float)
    GLat (float)
    GLong (float)
    Index (float)

moon(d, Index)
  Parameters:
    d (float)
    Index (float)

Element(d, pnum)
  Parameters:
    d (float)
    pnum (int)

kepler(m, ecc, eps)
  Parameters:
    m (float)
    ecc (float)
    eps (float)

rplanet(d, pnumber, Index)
  Parameters:
    d (float)
    pnumber (int)
    Index (float)

planet(d, pnumber, Index)
  Parameters:
    d (float)
    pnumber (int)
    Index (float)

altaz(d, DEC, RA, GLat, GLong, Index)
  Parameters:
    d (float)
    DEC (float)
    RA (float)
    GLat (float)
    GLong (float)
    Index (float)

prise(d, P, GLat, GLong, Index)
  Parameters:
    d (float)
    P (int)
    GLat (float)
    GLong (float)
    Index (float)

MoonSize(d)
  Parameters:
    d (float)

Refraction(Temperature_C, Atmospheric_Pressure_mBar, Altitude_Deg)
  Parameters:
    Temperature_C (float)
    Atmospheric_Pressure_mBar (float)
    Altitude_Deg (float)

MoonRise(d, Longitude, Latitude, Index)
  Parameters:
    d (float)
    Longitude (float)
    Latitude (float)
    Index (float)

f_to_sec(dec)
  Parameters:
    dec (float)

f_to_time(sec)
  Parameters:
    sec (float)

deg_to_time(deg)
  Parameters:
    deg (float)

toDMS(coordinate)
  Parameters:
    coordinate (float)

convertDMS(lat, lng)
  Parameters:
    lat (float)
    lng (float)

convlatdec(deg)
  Parameters:
    deg (float)

PlanetName(pnum)
  Parameters:
    pnum (int)

PlanetNameV(pnum)
  Parameters:
    pnum (int)

PlanetSign(pnum)
  Parameters:
    pnum (int)

PlanetColor(pnum)
  Parameters:
    pnum (int)

zodiaccolor(deg)
  Parameters:
    deg (float)

degsign(deg)
  Parameters:
    deg (float)

degsignf(deg)
  Parameters:
    deg (float)

degnash(deg)
  Parameters:
    deg (float)

degname(deg)
  Parameters:
    deg (float)

retrogradesym(deg)
  Parameters:
    deg (float)

degaspsign(deg)
  Parameters:
    deg (float)

degaspname(deg)
  Parameters:
    deg (float)

degaspfull(deg)
  Parameters:
    deg (float)

degaspfullV2(deg)
  Parameters:
    deg (float)

degaspnameV2(deg)
  Parameters:
    deg (float)

degtolowest180(deg)
  Parameters:
    deg (float)

degaspfullapproach(deg)
  Parameters:
    deg (float)

virinchiaspectcol(deg, bull_col, bear_col)
  Parameters:
    deg (float)
    bull_col (color)
    bear_col (color)

virinchiaspectemo(deg, bull_emo, bear_emo)
  Parameters:
    deg (float)
    bull_emo (string)
    bear_emo (string)

aspectfastsigndeg(deg)
  Parameters:
    deg (float)

aspectfastfull(deg)
  Parameters:
    deg (float)

aspectslowfull(deg)
  Parameters:
    deg (float)

aspectslowsigndeg(deg)
  Parameters:
    deg (float)

aspectslowsign(deg)
  Parameters:
    deg (float)

aspectsignprecision(deg, precision)
  Parameters:
    deg (float)
    precision (int)

aspectsignprecisionV2(deg, precision)
  Parameters:
    deg (float)
    precision (float)

aspectsignprecisionV2ext(deg, precision)
  Parameters:
    deg (float)
    precision (float)

IPaspectsignprecision(planet1, planet2, precision)
  Parameters:
    planet1 (float)
    planet2 (float)
    precision (float)

IPaspectsignprecisionFull(planet1, planet2, precision)
  Parameters:
    planet1 (float)
    planet2 (float)
    precision (float)

IPaspectlineprecision(planet1, planet2, precision, style, width)
  Parameters:
    planet1 (float)
    planet2 (float)
    precision (float)
    style (string)
    width (int)

rDeg(deg)
  Parameters:
    deg (float)

AngToCirc(angle)
  Parameters:
    angle (float)

AngToCirc180(angle)
  Parameters:
    angle (float)

sidereal(deg, sidereal)
  Parameters:
    deg (float)
    sidereal (bool)

J2000(JDN)
  Parameters:
    JDN (float)

JDN(t, d, tz)
  Parameters:
    t (float)
    d (float)
    tz (float)

getsun(index, day, dayr, latitude, longitude, tz)
  Parameters:
    index (int)
    day (float)
    dayr (float)
    latitude (float)
    longitude (float)
    tz (float)

getmoon(index, day, dayr, latitude, longitude)
  Parameters:
    index (int)
    day (float)
    dayr (float)
    latitude (float)
    longitude (float)

getplanet(planet, index, day, dayr, latitude, longitude, tz)
  Parameters:
    planet (int)
    index (int)
    day (float)
    dayr (float)
    latitude (float)
    longitude (float)
    tz (float)
Release Notes
The second edition of this library adds more than a dozen new celestial bodies to the offering, including Ceres, Juno, & Vesta.
astrologyastronomycycleMATHmoonplanetSUNTIME

Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House rules.


Made w/ ❤ by @BarefootJoey ✌💗📈
Also on:

Disclaimer