MetaStock -> Tools -> Indicator Builder -> New -> copy & paste complete formula below. ============ Lunar cycles ============ ---8<----------------------------------------- {Full/New/Q1/Q3 Moon signals indicator Mk XV. Plots: +1 signal on Full Moon; -1 on New Moon; +0.5 on first Quarter; -0.5 on last Quarter. Accurate to within 2 hours every 19 years. Signals that fall on holidays or weekends are plotted on the next trading day. Use the signal advance input to view approaching signals. Adj lunar signals to market's local Time Zone (generally add 1hr for Daylight Saving Time): New Zealand: +12hrs Australia: +10 Japan: +9 SE Asia: +8 Thai/Indonesia: +7 India: +5.5 Dubai: +4 Moscow: +3 Europe: +1 UK & Portugal: 0 USA, NY: -5 Chicago: -6 http://www.travel.com.hk/region/timezone.htm Copyright © 2001-2009 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } TZ:=Input("Market's local Time Zone? [-12hrs to +12hrs]",-12,12,-5); shift:=Input("Advance signal by x calendar days",-30,30,0); plot:=Input("Plot Q1 and Q3 (half) signals? [1]Yes, [0]No",0,1,0); { Lunar cycle length in days (synodic month) } LunarMonth:=29.53059; offset:=4.86; { Calendar engine } y:=Year()-(Month()<3); leap:=Int(y/4)-Int(y/100)+Int(y/400); mth:=Int((2+153*(Month()-3+12*(Month()<3)))/5); dayNr:=DayOfMonth()+mth+y*365+leap-657382 -offset-TZ/24+shift; { New/Q1/Full/Q3 Moon cycles } NM:=Frac((DayNr+LunarMonth/2)/LunarMonth); Q1:=Frac((DayNr+LunarMonth/4)/LunarMonth); FM:=Frac(DayNr/LunarMonth); Q3:=Frac((DayNr-LunarMonth/4)/LunarMonth); { Lunar cycle signals } cycle:=FM-NM; FM:=cycle<0 AND Alert(cycle>0,2); NM:=-(cycle>0 AND Alert(cycle<0,2)); cycle:=Q1-Q3; Q1:=(cycle<0 AND Alert(cycle>0,2))*.5; Q3:=(cycle>0 AND Alert(cycle<0,2))*-.5; signals:=If(plot=1,NM+Q1+FM+Q3,NM+FM); { Plot Lunar signals in own window } signals ---8<----------------------------------------- http://www.metastocktools.com Follow the Lunar indicator discussion at Traders' Consortium: http://tradersconsortium.com/community/index.php?showtopic=664 http://tradersconsortium.com/community/index.php?showtopic=673 Feedback from Kuala Lumpur (Malaysia) resident: "I've plotted the Lunar cycle indicator (FM: 9 Aug 2006), but found it differs from the Chinese calendar's 8 Aug 2006." KL Standard time zone: UTC/GMT +8 hours KL location: 3deg 8' N, 101deg 42' E. Exact Full Moon at KL: Wed 9th August 2006, 18:56 (6:56pm) local KL time The Lunar cycle indicator is correct, and the Chinese calendar shows a wrong Full Moon date in this case. Are Investors Moonstruck? - Lunar Phases and Stock Returns ======================== http://papers.ssrn.com/sol3/papers.cfm?abstract_id=283156 Psychological evidence and casual intuition predict that lunar phases regulate mood. This paper investigates the relation between lunar phases and stock market returns in 48 countries. We find strong global evidence that stock returns are lower on days around a full moon than on days around a new moon. The magnitude of the return difference is 6.6 percent per annum from our 15-day window panel analysis. The lunar effect is independent of other calendar-related anomalies such as the January effect, the day-of-week effect, and the calendar month effect.