TradingView
paaax
8 mar 2020 06:43

[PX] Moon Phase 

Euro Fx/U.S. DollarFXCM

Opis

Hello 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.
Komentarze
GMDJ789
I'm not a coder this help me a lot and Thank you for your hard work!
GarethSA
GREAT SCRIPT.

Is there a way to display the date on the moon or underneath it?
paaax
@GarethSA, good idea. I will have a look at it.
GarethSA
@paaax, thanks
GarethSA
@paaax, Maybe it can also show the next moon that is incoming as well
cyberalchemy
I was pretty excited to find this and tested it out right away. It's close for a general feel for cycles but not accurate to the day. I haven't tested extensively but I used a 1 day chart and the script showed new moon on Jan 14th and full moon on Jan 29th. The exact times were actually Jan 12th 9pm PST and Jan 28 11am PST, so both at least a good day off. If this script were right on the nose and showed quarter moons too it'd be perfect.
GarethSA
I think your moon labels are wrong was around in settings?
IntricateMoon
Thank you for sharing!
ethanKK
Thanks for sharing!!
budzap
It would be great to have the 8 moon phases de marked in the way done in InSilico's Moon Cycles script.
Więcej