Astro: Planetary Channel LinesPlanetary Channel Lines is an approach to financial astrology that involves using the positions of the planets to predict trends and patterns in the stock market. The idea behind planetary lines is that the positions of the planets in the sky at the time of a market event can significantly influence that event.
The planetary lines approach involves mapping the planets' positions onto a stock market graph, with each planet's position representing a specific line. These lines are thought to indicate areas of support and resistance, as well as potential turning points in the market.
This indicator includes geocentric/heliocentric planetary lines on the chart for up to two planets, price scaling & vertical offset, retrograde highlighting, and aspect recognition with customizable precision.

# Moon

Astro: Celestial CoordinatesCelestial coordinates are a system of measurements used in astronomy and astrology to describe the positions of celestial objects such as stars, planets, and constellations. There are several different celestial coordinates, including right ascension (RA), longitude, latitude, declination, and altitude. Each coordinate has its own astronomical or astrological significance, as outlined below:
Right ascension (RA) is a coordinate used to describe the position of an object in the sky along the celestial equator. It is measured in hours, minutes, and seconds and is analogous to longitude on Earth. RA is significant in both astronomy and astrology because it allows astronomers and astrologers to accurately locate celestial objects in the sky.
Longitude is a coordinate used to describe the position of a planet or other object in its orbit around the Sun. It is measured in degrees and is significant in astronomy because it allows astronomers to accurately predict the positions of planets and other objects in the solar system.
Latitude is a coordinate used to describe the position of an object in the sky relative to the celestial equator. It is measured in degrees and is significant in both astronomy and astrology because it helps astronomers and astrologers to determine the positions of celestial objects in the sky.
Declination is a coordinate used to describe the position of an object in the sky relative to the celestial equator, similar to latitude but measured in degrees north or south of the celestial equator. It is significant in astronomy because it allows astronomers to accurately locate objects in the sky.
Altitude is a coordinate used to describe the height of an object above the horizon. It is measured in degrees and is significant in both astronomy and astrology because it allows astronomers and astrologers to determine when objects will be visible in the sky and at what angle.
In astrology, celestial coordinates are used to create maps of the positions of celestial objects. This indicator plots the corresponding celestial coordinate
values for each planet, moon, or sun and labels key turning (pivot) points with a date (& optional time). Hover over labels for additional information.

Astro: Planetary SpeedPlanetary speed refers to the rate at which a planet moves along its orbit around the Sun. The speed of a planet can vary depending on its distance from the Sun, and is generally fastest at the point in its orbit where it is closest to the Sun (perihelion) and slowest at the point where it is farthest from the Sun (aphelion).
The significance of planetary speeds lies in their astrological interpretation. In astrology, the speed of a planet is thought to influence its energy and influence earthly affairs. Fast-moving planets, such as Mercury and Venus, are believed to have a more immediate and fleeting influence, while slower-moving planets, such as Jupiter and Saturn, are thought to have a more long-lasting and significant impact.
Astrologers use the speed of the planets, along with their positions, aspects, and other factors, to interpret their influence. By understanding the energy and symbolism associated with each planet, astrologers can provide insight and guidance to individuals seeking a greater understanding.

Astro: Solar SystemA bird's eye view model of the solar system is a simplified representation of our planetary system as seen from above. It can be thought of as a two-dimensional map of the solar system, in which the planets are shown in their approximate heliocentric longitudinal positions relative to the Sun and each other.
In this model, the Sun is shown as a large, central emoji, with the planets arranged in orbits around it. The inner planets - Mercury, Venus, Earth, and Mars - are located close to the Sun and inside the asteroid belt, while the outer planets - Jupiter, Saturn, Uranus, Neptune, and Pluto- are located farther out.
In a bird's eye view model, some of the details of the solar system are necessarily left out or simplified. For example, the distances between the planets are not to scale, and the orbits are shown as perfect circles rather than the elliptical shapes they actually are. Nonetheless, this model can provide a useful visual real-time representation of the relative heliocentric longitudinal positions (aspects) of the planets in our solar system.
🏅 Shoutout to @LuxAlgo for the circle code!

Astro: Planetary Aspect TableIn astrology, planetary aspects refer to the angles formed between two or more planets in a horoscope or birth chart. These angles are created by the positions of the planets in the sky and are thought to represent a particular energy or influence that can impact events on Earth.
The most common planetary aspects are the conjunction (when two planets are in the same position in the zodiac), the opposition (when two planets are direct across from each other in the zodiac), the trine (when two planets are 120 degrees apart in the zodiac), and the square (when two planets are 90 degrees apart in the zodiac).
This chart overlay displays a real-time table of current interplanetary aspects for all AstroLib celestial body combinations.

Astro: Planetary Aspect DatesIn astrology, planetary aspects refer to the angles formed between two or more planets in a horoscope or birth chart. These angles are created by the positions of the planets in the sky and are thought to represent a particular energy or influence that can impact events on Earth.
The most common planetary aspects are the conjunction (when two planets are in the same position in the zodiac), the opposition (when two planets are direct across from each other in the zodiac), the trine (when two planets are 120 degrees apart in the zodiac), and the square (when two planets are 90 degrees apart in the zodiac).
This chart overlay is a simple companion indicator that highlights aspect dates for the following oscillator:

Astro: Planetary AspectsIn astrology, planetary aspects refer to the angles formed between two or more planets in a horoscope or birth chart. These angles are created by the positions of the planets in the sky and are thought to represent a particular energy or influence that can impact events on Earth.
The most common planetary aspects are the conjunction (when two planets are in the same position in the zodiac), the opposition (when two planets are direct across from each other in the zodiac), the trine (when two planets are 120 degrees apart in the zodiac), and the square (when two planets are 90 degrees apart in the zodiac).
This oscillator plots the current geocentric/heliocentric aspect for up to two planets and features a customizable precision of degree (up to +/- 15 degrees) for each aspect.

AstroLibLibrary "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)

Moon Phases + Daily, Weekly, Monthly, Quarterly & Yearly Breaks█ Moon Phases
From LuxAlgo description.
Trading moon phases has become quite popular among traders, believing that there exists a relationship between moon phases and market movements.
This strategy is based on an estimate of moon phases with the possibility to use different methods to determine long/short positions based on moon phases.
Note that we assume moon phases are perfectly periodic with a cycle of 29.530588853 days (which is not realistically the case), as such there exists a difference between the detected moon phases by the strategy and the ones you would see. This difference becomes less important when using higher timeframes.
█ Daily, Weekly, Monthly, Quarterly & Yearly Breaks
This indicator marks the start of the selected periods with a vertical line that help with identifying cycles.
It allows to enable or disable independently the daily, weekly, monthly, quarterly and yearly session breaks.
This script is based on LuxAlgo and kaushi / icostan scripts.
Moon Phases Strategy
Year/Quarter/Month/Week/Day breaks
Month/week breaks

Moon Launch Alerts Template [Indicator]I created this indicator/study script because i ran into the issue that the same Alerts would fire multiple times. For example it would trigger a Long signal when already being in a Long. I guess there would be no issue with a very basic strategy but with a larger script and many variables, it seemed to create complications.
This is resolved by a TradingLine oscillator and only when it switches to a new and different position from previous, will it trigger an Alert.
If you are in a Long and it signals Long again, then this is seen as a "Continuation Long" in the Alerts settings. You can use this condition to add to your existing position (Optional). Continuation signals are plotted as bright green/red dots.
You will notice there's an option to uncheck "Trade Shorts" and "Trade Exits" signals.
Lets say you choose not to trade Short and Exits, then your Long would only Exit once a Short signal is detected.
This could prove useful for Back-testing purposes.
This quick example script uses the EMA 10, EMA 200, emaPlus1Atr and emaMinus1Atr.
To use in your script, you will need to modify and add your own BUY/SELL/EXIT signals in the box where it says:
//// INPUT YOUR BUY/SELL/EXIT SIGNALS HERE: ////
//////////////////////////////////////////////////
Hope someone will find this useful, or even just as an additional visual confirmation for your own trading strategy and script.

Moon Phases Strategy [LuxAlgo]Trading moon phases has become quite popular among traders, believing that there exists a relationship between moon phases and market movements. This strategy is based on an estimate of moon phases with the possibility to use different methods to determine long/short positions based on moon phases.
Note that we assume moon phases are perfectly periodic with a cycle of 29.530588853 days (which is not realistically the case), as such there exists a difference between the detected moon phases by the strategy and the ones you would see. This difference becomes less important when using higher timeframes.
Settings
New Moon Reference Date: Date of a new moon to be used as starting point for the cycle calculation. Buy: Determine the condition to be used to open a long position Sell: Determine the condition to be used to open a short position
Description
The strategy can use different buy/sell conditions, these are determined in the Buy/Sell settings drop-down menu.
By default, the strategy goes long on a new moon and short on a full moon. This setup is common since full moons are said to be related to depressed mood. However, it is possible to use inverse conditions.
Users can also go long on higher moons (new moons or full moons occurring at a price that is higher than the previous one when a new/full moon occurred) and short on lower moons, this would return a trend following strategy, using the inverse conditions (buy lower moons/sell higher moons) would return a contrarian strategy.
The above chart displays the strategy using default conditions.
The above chart displays the strategy of going long on a higher moon and selling on a lower moon.
Quick Summary
We provide a quick summary of the strategy using default conditions (buy on a new moon, sell on a full moon) on various tickers using the 4h timeframe (note that using a lower timeframe would return a backtest executing a lower number of trades).
Constant position sizing is used and no frictional costs are considered.
BTCUSD
The moon phases strategy has been regularly tested with BTCUSD, with traders highlighting how moon phases tend to occur during tops/bottoms. We test the strategy from 2019-01-06 00:00.
Net Profit: $68544.86 Closed Trades : 67 % Profitability : 50.75 Max Drawdown : $18541.24 Max
TSLA
The strategy is tested from 2011-01-04 14:30
Net profit: $349.17 Closed Trades : 265 % Profitability : 54.34 Max Drawdown : $262.72
EURUSD
The strategy is tested from 2018-01-16 14:00.
Net profit: $-0.18 Closed Trades : 91 % Profitability : 50.55 Max Drawdown : 0.36

[astropark] Moon Phases [alarms]Dear Followers,
today I'm glad to present you an indicator which calculates Moon Phases and let's you set an alert over it.
This is a public free indicator based on the public one by @paaax:
I added my usual alert system logic, plus some more customization inputs for easy coloring.
The lower the timeframe you use it and set your alerts on, the more precise the alert value you get.
Here below the script for backtesting it:
Enjoy!
-- astropark

[astropark] Moon Phases [strategy]Dear Followers,
today I'm glad to present you an indicator which calculates Moon Phases and let's you backtest the simplest strategy over it: buy/sell on full moon and do the opposite on new moon.
This is a public free indicator based on the public one by @paaax:
I added my usual backtesting logic, plus some more customization inputs for easy coloring.
The lower the timeframe you backtest on, the more backtesting data are effective.
Enjoy!
-- astropark

Simple Moon Phases StrategySimple Moon Phases Strategy
This strategy is very basic and needs some filters to improve results. It was created to test the Moon Phase theory compared to just a buy and hold strategy and it did not beat the buy and hold. However, if you flip the entry and exit signals to the opposite signals it performs a lot worse, so there might be some validity to the Moon Phases having an effect on the markets. I might try to add some filters and increase hold times with trailing stops in a separate version.
WARNING: This strategy uses hard-coded dates from 1/1/2015 until 12/31/2021 only! Any dates outside of that range need to be added manually in the code or it will not work. I may or may not update this so please don't be upset if it stops working after 12/31/2021.
Feel free to use any part of this code and please let me know if you can improve on this strategy.

Financial Astrology Moon SpeedThe acceleration of the Moon seems to be important in determining the periods of increasing volatility, when the speed is accelerating we can note that the price range of the candles during the acceleration period is greater than the candles during the deceleration period. In other words, the speed increase produce stronger effect in the price action and is expected that Moon aspects during speed acceleration are more intense than the ones formed during deceleration.
In order to evaluate this astro trading pattern, observe when Moon touch the speed minima around 11.5 degrees per day, at that point the speed curve start to increase until it reach the maxima around 15 degrees per day, within this period the candles price range seems to be more intense.
Note: The Moon speed indicator is based on an ephemeris array that covers years 2010 to 2030, prior or after this years the speed is not available, this daily ephemeris are based on UTC time so in order to align properly with the price bars times you should set UTC as your chart timezone.

Financial Astrology Moon DeclinationIt's said by financial astrologers that Moon in extreme declinations above or below 22, tends to produce more extreme effects of the Moon energy effects. My friend Peter advised that extreme declinations are very intense energy points and when the extreme is reached a reversal effect is expected. We are not quite sure if this rule is valid so this indicator is to validate the this empirical observations.
Note: The Moon declination indicator is based on an ephemeris array that covers years 2010 to 2030, prior or after this years the declination is not available, this daily ephemeris are based on UTC time so in order to align properly with the price bars times you should set UTC as your chart reference timezone.

Financial Astrology Moon LongitudeMoon energy represent the masses, crowds, public places, children and emotions. The transit of the Moon through the zodiacal signs will color the crowd emotional responses that fluctuate based on the elemental qualities of the signs: fire (energetic and impulsive), earth (rigid, static, patient), water (assimilation, transformation, humor fluctuations), air (expansion, fervent, germination).
The daily average speed of the Moon is 13 degrees, for this reason the emotional elemental energy is transforming in average every 2 days and few hours, this mood fluctuations produces the short term instinctive and emotional actions performed by traders that forget the precise mathematical / statistical approach in favor of irrational and emotional impulses.
Based on statistical buy/sell frequency analysis we discovered that for BTC-USD, the Moon is usually bullish in zodiac signs: Aries, Libra, Scorpio, Aquarius and Pisces, the most relevant bullish sign is "Aquarius", from 206 observations in all the BTC-USD price history where Moon was in this sign the 60% of those days the price increased compared to the previous day. The bearish zodiac signs for BTC-USD are: Taurus, Cancer, Leo, Sagittarius and Capricorn, the most relevant bearish sign is "Capricorn".
Interestingly this zodiac sign locations tends to fluctuate during some periods of time and from the last 10 observations of the Moon transiting through Aries we noted that 7 of the 10 observations coincide with a dip, sometimes the Moon in Aries indicate the reversal of the short term trend, this is kind of expected considering that when Moon approaches Taurus the fall becomes more likely due to the fact that Moon in Taurus is a bearish signal.
With this indicator there is unlimited possibilities to explore across different markets and complementing with Moon phases this may be the perfect financial astrology indicator for those intraday traders that keep positions only for few hours.
We encourage you to analyze the Moon zodiac sign cycles in different markets and share with us your observations, leave us a comment with your research outcomes. Happy trading!
Note: The Moon longitude indicator is based on an ephemeris array that covers years 2010 to 2030, prior or after this years the longitude is not available, this daily ephemeris are based on UTC time so in order to align properly with the price bars times you should set UTC as your chart reference timezone.

[PX] Moon PhaseHello guys,
while scrolling through the public library, I was surprised that there was no Open-Source version of the Moon Phase indicator. All moon phase indicators in the public library were either protected or not exactly what I was looking for. There is a built-in "Moon Phase" indicator, but even for this one, we can't access its source code.
Therefore, I started searching for an algorithm that I could implement into PineScript.
So here we go, an Open-Source Moon Phase indicator. It comes with the option to color the background based on the recent moon. Compared to the built-in indicator, the moon is slightly shifted, because it is centered on the candle and not plotted between two candles like the built-in indicator is doing it.
Feel free to use the indicator for your analysis or build on top of it in an open-source fashion.
Happy trading,
paaax :)
Reference: This indicator is a converted and simplified version of the original javascript algorithm, which can be found here .