[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Full Moon indicator (EL code)



PureBytes Links

Trading Reference Links

<x-html><html><head></head><BODY bgcolor="#FFFFFF"><p><font size=5 color="#0000FF" face="Arial">hi thank you for the indicator <br>i down load but cann't open I guss i am not so familer with the net and or ts<br>if you would be kind to give instraction on how to bring it in and use it I w'll app. <br>thank you have a great weekend .<br><br>----------<br>&gt; From: Gary Funck &lt;<u>gary@xxxxxxxxxxxx</u>&gt;<br>&gt; To: RealTraders Discussion Group &lt;<u>realtraders@xxxxxxxxxxxxxx</u>&gt;<br>&gt; Subject: GEN: Full Moon indicator (EL code)<br>&gt; Date: Friday, July 18, 1997 1:47 PM<br>&gt; <br>&gt; Traders, find below an Easy Language implementaiton of a calculation<br>&gt; that approximates the phase of the moon, and an associated indicator<br>&gt; and system. &nbsp;This calculation isn't as accurate as the method used<br>&gt; by the authors of the TAS&amp;C article, but has the advantages of being<br>&gt; simple and implemented completely in EL.<br>&gt; <br>&gt; The Moonphase indicator is useful for giving a visual cue as to<br>&gt; where the market is in the current lunar cycle, and might be combined<br>&gt; with other indicators such as momemtum, or RSI to produce a useful<br>&gt; system.<br>&gt; <br>&gt; Have fun with the code, and if you find any problems, or have<br>&gt; suggestions for improvement, I'd like to hear from you. &nbsp;If<br>&gt; you want to avoid the cut/paste exercise, pick up the<br>&gt; EL archive at <u>ftp://www.intrepid.com/pub/gary/MOON.ELA</u><br>&gt; <br>&gt; howl on,<br>&gt; <br>&gt; &nbsp;&nbsp;&nbsp;- Gary<br>&gt; <br>&gt; {<br>&gt; &nbsp;&nbsp;Function Moondays returns the number of days since a new moon.<br>&gt; &nbsp;&nbsp;The values returned range between 0 and 29.<br>&gt; &nbsp;&nbsp;(0 = new, and 15 is a full moon to +/- 2 day accuracy.)<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Author: Gary Funck, <u>gary@xxxxxxxxxxxx</u>, 7/15/97<br>&gt; &nbsp;&nbsp;No restrictions on use/copying. No warranties, expressed/implied.<br>&gt; <br>&gt; &nbsp;&nbsp;This code uses an approximation described in the the &quot;Astro FAQ&quot;;<br>&gt; &nbsp;&nbsp;summarized below:<br>&gt; <br>&gt; &nbsp;&nbsp;Subject: C.11 &nbsp;How do I calculate the phase of the moon?<br>&gt; &nbsp;&nbsp;Author: Bill Jefferys &lt;<u>bill@xxxxxxxxxxxxxxxxxxx</u>&gt;<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;John Horton Conway (the Princeton mathematician who is responsible for<br>&gt; &nbsp;&nbsp;&quot;the Game of Life&quot;) wrote a book with Guy and Berlekamp, _Winning<br>&gt; &nbsp;&nbsp;Ways_, that describes in Volume 2 a number of useful calendrical<br>&gt; &nbsp;&nbsp;rules. &nbsp;One of these is an easy &quot;in your head&quot; algorithm for<br>&gt; &nbsp;&nbsp;calculating the phase of the Moon, good to a day or better depending<br>&gt; &nbsp;&nbsp;on whether you use his refinements or not.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;In the 20th century, calculate the remainder upon dividing the<br>&gt; &nbsp;&nbsp;last two digits of the year by 19; if greater than 9, subtract<br>&gt; &nbsp;&nbsp;19 from this to get a number between -9 and 9. <br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Multiply the result by 11 and reduce modulo 30 to obtain a<br>&gt; &nbsp;&nbsp;number between -29 and +29.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Add the day of the month and the number of the month (except<br>&gt; &nbsp;&nbsp;for Jan and Feb use 3 and 4 for the month number instead of<br>&gt; &nbsp;&nbsp;1 and 2).<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Subtract 4.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Reduce modulo 30 to get a number between 0 and 29. This is<br>&gt; &nbsp;&nbsp;the age of the Moon.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Example: What was the phase of the Moon on D-Day (June 6,<br>&gt; &nbsp;&nbsp;1944)?<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Answer: 44/19=2 remainder 6.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;6*11=66, reduce modulo 30 to get 6.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Add 6+6 to this and subtract 4: 6+6+6-4=14; the Moon was (nearly)<br>&gt; &nbsp;&nbsp;full. I understand that the planners of D-day did care about the phase<br>&gt; &nbsp;&nbsp;of the Moon, either because of illumination or because of tides. I<br>&gt; &nbsp;&nbsp;think that Don Olsen recently discussed this in _Sky and Telescope_<br>&gt; &nbsp;&nbsp;(within the past several years).<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;In the 21st century use -8.3 days instead of -4 for the last number.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Conway also gives refinements for the leap year cycle and also<br>&gt; &nbsp;&nbsp;for the slight variations in the lengths of months; what I have<br>&gt; &nbsp;&nbsp;given should be good to +/- a day or so.<br>&gt; }<br>&gt; inputs: dt(numericsimple);<br>&gt; variables: x1(0), x2(0), x3(0), x4(0);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;x1 = mod(year(dt), 19);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;if x1 &gt; 9 then x1 = x1 - 19;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;x2 = mod(x1 * 11, 30);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;x3 = month(dt);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;if month(dt) &lt; 3 then x3 = x3 + 2;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;x4 = x2 + dayofmonth(dt) + x3 - 4;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;Moondays = mod(x4, 30);<br>&gt; <br>&gt; <br>&gt; { <br>&gt; &nbsp;&nbsp;Indicator Moonphase, returns a value between 0..100, that<br>&gt; &nbsp;&nbsp;indicates (approximately) the fullness of the moon, where<br>&gt; &nbsp;&nbsp;0 is a new moon, and 100 is a full moon. &nbsp;This indicator<br>&gt; &nbsp;&nbsp;calls the Moondays function, and is accurate to +/- 2 days.<br>&gt; &nbsp;&nbsp;<br>&gt; &nbsp;&nbsp;Accepts an input, offset, which should be in the range -14..14.<br>&gt; &nbsp;&nbsp;Generally, you will not need to change the offset value, unless<br>&gt; &nbsp;&nbsp;for example, you want the display to agree with the offset<br>&gt; &nbsp;&nbsp;value used by Moontrade.<br>&gt; <br>&gt; &nbsp;&nbsp;Author: Gary Funck, <u>gary@xxxxxxxxxxxx</u>, 7/15/97<br>&gt; &nbsp;&nbsp;No restrictions on use/copying. No warranties, expressed/implied,<br>&gt; <br>&gt; }<br>&gt; input: offset(0);<br>&gt; variables: &nbsp;dt(0), phase(0), mday(0);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;dt = juliantodate(datetojulian(date) + offset);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;mday = Moondays(dt); <br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;phase = 100*( mday / 15);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;if phase &gt; 100 then phase = 200 - phase;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;plot1(phase, &quot;moon phase&quot;);<br>&gt; <br>&gt; <br>&gt; { <br>&gt; &nbsp;&nbsp;System Moontrade - buy the new moon, and sell the full moon.<br>&gt; <br>&gt; &nbsp;&nbsp;Accepts an input, offset, &nbsp;which should be in the range -14..14.<br>&gt; &nbsp;&nbsp;If the offset is +1, then the system buys at the open of the<br>&gt; &nbsp;&nbsp;day of a new moon and sells at the open on the day of the full moon.<br>&gt; <br>&gt; &nbsp;&nbsp;Try optimizing the 'offset' (using a range -14..14 in steps<br>&gt; &nbsp;&nbsp;of 1), or changing the system to only buy the new moon and<br>&gt; &nbsp;&nbsp;go flat on the full moon, when trading decidedly bullish<br>&gt; &nbsp;&nbsp;equity indexes.<br>&gt; <br>&gt; &nbsp;&nbsp;Author: Gary Funck, <u>gary@xxxxxxxxxxxx</u>, 7/15/97<br>&gt; &nbsp;&nbsp;No restrictions on use/copying. No warranties, expressed/implied,<br>&gt; <br>&gt; }<br>&gt; input: offset(0);<br>&gt; variables: dt(0), dtnxt(0), mday(0), mdaynxt(0);<br>&gt; variables: new_moon(true), full_moon(false);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;dt = juliantodate(datetojulian(date) + offset);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;dtnxt = juliantodate(datetojulian(date Tomorrow) + offset); <br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;mday = Moondays(dt);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;mdaynxt = Moondays(dtnxt);<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;new_moon = mdaynxt &lt; mday;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;full_moon = mdaynxt &gt;= 15 and mday &lt; 15;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;if new_moon then buy at market;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;if full_moon then sell at market;<br>&gt; <br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- end --<br>&gt; <br>&gt; -- <br>&gt; --<br>&gt; | Gary Funck, &nbsp;Intrepid Technology, <u>gary@xxxxxxxxxxxx</u>, (415) 964-8135</p>
</font></body></html></x-html>From ???@??? Sun Jul 20 22:34:40 1997
Received: from smtp1.nwnexus.com (smtp1.nwnexus.com [198.137.231.16])
	by mail1.halcyon.com (8.8.5/8.8.5) with ESMTP id PAA28539
	for <neal@xxxxxxxxxxxxxxxx>; Fri, 18 Jul 1997 15:38:21 -0700 (PDT)
Received: from list.listserver.com (list.listserver.com [198.68.191.15])
	by smtp1.nwnexus.com (8.8.5/8.8.5) with ESMTP id PAA13310
	for <neal@xxxxxxxxxxx>; Fri, 18 Jul 1997 15:36:56 -0700
Received: from host (localhost [127.0.0.1])
          by list.listserver.com (8.8.4/8.8.4) with SMTP
	  id OAA07639; Fri, 18 Jul 1997 14:55:31 -0700
Received: from emout14.mail.aol.com (emout14.mx.aol.com [198.81.11.40])
          by list.listserver.com (8.8.4/8.8.4) with ESMTP
	  id OAA07546 for <realtraders@xxxxxxxxxxxxxx>; Fri, 18 Jul 1997 14:53:36 -0700
Received: (from root@xxxxxxxxx)
	  by emout14.mail.aol.com (8.7.6/8.7.3/AOL-2.0.0)
	  id RAA22216 for realtraders@xxxxxxxxxxxxxx;
	  Fri, 18 Jul 1997 17:53:59 -0400 (EDT)
Message-Id: <970718175357_474391683@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Jul 1997 17:53:59 -0400 (EDT)
Reply-To: JColanzi@xxxxxxx
Sender: owner-realtraders@xxxxxxxxxxxxxx
From: JColanzi@xxxxxxx
To: RealTraders Discussion Group <realtraders@xxxxxxxxxxxxxx>
Subject: Re:option writers
X-Listprocessor-Version: 8.1 -- ListProcessor(tm) by CREN
X-UIDL: 3e189a012674d415d403520cc6b43282

I've updated my site stop by.
http://member.aol.com/jcolanzi/index.html