PureBytes Links
Trading Reference Links
|
It appears to me that the moon phase does have some statistical bias that
could be used. I took one of the files posted by robert@xxxxxxxxx and
added trading code. In the trading code I put optimize statements to buy
at the full moon, or some day after that which varied from 1 to 28 and to
hold for a fixed number of days from 1 to 10. I then ran an AA Optimize
for data since 12/1/88 and looked at the 3D graphs to see how the CAR
varied depending on which day after the full moon the trade started. I set
the timezone to -5 to be U.S. Eastern. I tested on Russell 2000, S&P500
and Nasdaq averages.
With that setup the days 5 to 7 after the full moon and 1 or 2 before the
full moon produced considerably more return, on average, than other
days. In fact the best days produced about 80 to 90% of the average yearly
return for the index, even though the system was only invested for less
than half the month.
The yearly return is not high enough for this to be a stand-alone system,
but it could be combined with some other system to bias the amount bought
if the other factors produced a buy signal in the good moon days. For
instance, you might want to buy with some margin leverage if the other
system produced a buy on the favorable moon days.
Dave H.
//From: "rhoemke" <robert@xxxxxxxxx>
//Sender: amibroker@xxxxxxxxxxxxxxx
//Mailing-List: list amibroker@xxxxxxxxxxxxxxx; contact
amibroker-owner@xxxxxxxxxxxxxxx
//Date: Sat, 02 Sep 2006 20:44:51 -0000
// Input your local time zone
TZ=Param("Your local Time Zone? [-12 to +12hrs]",-5, -12,12,1);
// Lunar cycle
LunarMonth=29.530589;
Offset=7.254621;
// Calendar }
leap=frac(Year()/4)==0 AND frac(Year()/100)!=0 OR frac(Year()/400)==0;
y=Year()*365+int(Year()/4)-int(Year()/100)+int(Year()/400);
m=
IIf(Month()==2,31-leap,
IIf(Month()==3,59,
IIf(Month()==4,90,
IIf(Month()==5,120,
IIf(Month()==6,151,
IIf(Month()==7,181,
IIf(Month()==8,212,
IIf(Month()==9,243,
IIf(Month()==10,273,
IIf(Month()==11,304,
IIf(Month()==12,334, -leap)))))))))));
CurrentDay=y+m+Day()-TZ/24-Offset;
// Full Moon }
FM=frac(CurrentDay/LunarMonth);
FM=PeakBars(FM, 1, 1)==0;
// New Moon }
NM=frac((CurrentDay+LunarMonth/2)/LunarMonth);
NM=PeakBars(NM, 1,1)==0;
//Plot Moon signals in own window }
Plot(FM-NM, "Moonphase, Red = New, Black = Full", IIf((FM-NM)> 0,
colorBlack, colorRed), styleHistogram);
// ----------------------------------------------------------------------------
// Set Delay
// ----------------------------------------------------------------------------
SetTradeDelays( 0, 0, 0, 0 );
Startoffset = Optimize("startoffset", 0, 1, 28, 1);
Hold_days = Optimize("hold_days", 4, 1, 10, 1);
MBuy = Ref(FM, -Startoffset) > 0.5;
MSell = Ref(FM, -Hold_days -startoffset ) > 0.5;
Buy = DateNum() >= 881201 && (MBuy);
Sell = DateNum() <= 881130 || (MSell);
Buy = Flip(Buy, Sell);
Sell = NOT Buy;
|