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

Re: [amibroker] Re: Moon Phase Indicator



PureBytes Links

Trading Reference Links

Translated:
// Full/New Moon signals indicator
// Accurate to within 1 Minute per 69 years }

// Plots +1 Signal on Full Moon; -1 on New Moon
//   if FM/NM falls on a holiday OR weekend,
//      Signal is plotted on the nearest trading Day }
//   Warning: will NOT Plot last FM/NM Signal
//   until it is confirmed on next trade Day }

//  Input your world time zone
      TZ = Param("Time Zone",-5,-12,12);

// Lunar cycle
     LunarMonth = 29.530589;
     Offset = 7.254621;

// Calendar
// leap = frac(Year()/4)=0 AND frac(Year()/100)<0 OR frac(Year()/400)=0;
     leap1 = IIf(frac(Year()/4)==0,1,0);
     leap2 = IIf(frac(Year()/100)<0,1,0);
     leap3 = IIf(frac(Year()/400)==0,1,0);
     leap  = Leap1 AND Leap2 AND Leap3;

     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/New Moon }
     FM = frac(CurrentDay/LunarMonth);
     NM = frac(FM+0.5);

//  Plot in own window below chart }
Plot(fm,"Full Moon",colorBlue,styleLine);
Plot(nm,"New Moon",colorRed,styleLine);
//    (PeakBars(1,FM,.01)=0)-(PeakBars(1,NM,.01)=0)
Filter=1;

thorstef2003 wrote:
> Thank you, Dave. 
> Was hoping someone had the AFL, but this link is a good step forward.
> Very surprising, that after so many years of AB, nobody programmed a 
> moon phase AFL!?
> 
>>>> { Full/New Moon signals indicator MkVI }
>>>> { Accurate to within 1 minute per 69 years }
>>>> { ©Copyright 2002-2004 jose silva }
>>>> { For personal use only }
>>>> { josesilva22@xxxx }
>>>>
>>>> { Plots +1 signal on Full Moon; -1 on New Moon }
>>>> { If FM/NM falls on a holiday or weekend,
>>>>   signal is plotted on the nearest trading day }
>>>> { Warning: will not plot last FM/NM signal
>>>>    until it is confirmed on next trade day }
>>>>
>>>> { Input your world time zone }
>>>> TZ:=Input("Your Time Zone?  (-12 to +12hrs)",
>>>>  -12,12,10);
>>>>
>>>> { 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:=
>>>>  If(Month()=2,31-leap,
>>>>  If(Month()=3,59,
>>>>  If(Month()=4,90,
>>>>  If(Month()=5,120,
>>>>  If(Month()=6,151,
>>>>  If(Month()=7,181,
>>>>  If(Month()=8,212,
>>>>  If(Month()=9,243,
>>>>  If(Month()=10,273,
>>>>  If(Month()=11,304,
>>>>  If(Month()=12,334,
>>>>  -leap)))))))))));
>>>> CurrentDay:=y+m+DayOfMonth()-TZ/24-Offset;
>>>>
>>>> { Full/New Moon }
>>>> FM:=Frac(CurrentDay/LunarMonth);
>>>> NM:=Frac(FM+0.5);
>>>>
>>>> { Plot in own window below chart }
>>>> (PeakBars(1,FM,.01)=0)-(PeakBars(1,NM,.01)=0)
>>>>
> Anyone able to translate this?
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "MarketMonk777" <dlittner@xxx> 
> wrote:
>> Hi Stef,
>>
>> Check out this link:
>> http://www.purebytes.com/archives/metastock/2004/msg05973.html
>>
>> The code is for MetaStock but am fairly certain it can be converted.
>>
>> And here is a long winded conversation about planet's and the 
> markets:
>> http://www.purebytes.com/archives/omega/2003/msg05801.html
>>
>> And finally, code for Omega Tradestation, which is a little bit 
> tougher in
>> some cases to convert:
>> http://www.purebytes.com/archives/omega/2002/msg00476.html
>>
>> Regards,
>>
>> Dave
>> MarketMonk 
>>
>> -----Original Message-----
>> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
> On Behalf
>> Of thorstef2003
>> Sent: Sunday, July 09, 2006 9:31 AM
>> To: amibroker@xxxxxxxxxxxxxxx
>> Subject: [amibroker] Moon Phase Indicator
>>
>> Hi,
>> I've gone through all the archives and nobody seems to have 
> programmed an
>> indicator to overlay moon pases on the price charts.
>> Can somebody please provide a link or the AFL of a moon phase 
> indicator?
>> Thanks.
>> Stef 
>>
>>
>>
>>
>>
>> Please note that this group is for discussion between users only.
>>
>> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at}
>> amibroker.com
>>
>> For other support material please check also:
>> http://www.amibroker.com/support.html
>>
>>  
>> Yahoo! Groups Links
>>
> 
> 
> 
> 
> 
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
>