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

Re: [amibroker] Re: Heads up with XP SP-2 and Metastock Downloader



PureBytes Links

Trading Reference Links

Tomasz,

I like being wrong when the right answer is Amibroker already does this! I
searched help dday and itıs not there. May I suggest that the looping
functions be cross referenced to the array functions?

I must correct your formula using arrays. As is, it misses expiration
Fridays when the following Monday is a holiday. (Jan 2004, Jan 2003, maybe
others.)


Here is an entire piece of code that finds the 3rd Friday of all months
(provided there are no data holes).

/*This AFL finds the third Friday of every month and computes the ROC since
the previous third Friday. It plots the results and marks the day in white.
*/
 
WriteIf(((DayOfWeek()<5 AND Ref( DayOfWeek(), 1 ) < 2) OR DayOfWeek()==5)
AND Day() > 14  AND Day() < 22,"Expiration Friday\n","-\n");
 
percent = Param("% Limit",5,1,10,1);
 
expiry = IIf(((DayOfWeek()<5 AND Ref( DayOfWeek(), 1 ) < 2) OR
DayOfWeek()==5) AND Day() > 14  AND Day() < 22,True,False);
periods = IIf(expiry,BarsSince(Ref(expiry,-1))+1,0);
expiryROC = IIf(expiry,(C-Ref(C,-periods))/Ref(C,-periods),0) * 100; //ROC
with variable period
Plot(expiryROC,"Monthly Rate of
Change",IIf(expiryROC>percent,colorGreen,IIf(expiryROC<-percent,colorRed,col
orBlack)),styleDots);
Plot(percent,"+" + percent + "%",colorGreen);
Plot(-percent,"-" + percent + "%",colorRed);
"Number of breakouts = " + Cum(IIf(abs(expiryROC)>percent,1,0));
"Number of successes = " + Cum(IIf(abs(expiryROC)<=percent AND
expiryROC!=0,1,0));
Plot(expiry,"Expiry",colorWhite,styleHistogram);

--

> Hello,
>  
> You are wrong.
> You definitely CAN access day/date/dayofweek in array !!!
>  
> dday = Day();
> ddow = DayOfWeek();
>  
> for( i = 0; i < BarCount; i++ )
> {
>    // access day in loop :
>    something =  dday[ i ] ;
>    somethingelse = ddow[ i ];
> }
>  
> And you can do what you need also without any loops.
>  
> Instead of:
>  
> expiry = IIf(DayOfWeek()==5 AND Day() > 14  AND Day() < 22,True,False);
>  
> Write:
> expiry = IIf(DayOfWeek()<=5 AND Ref( DayOfWeek() < 2, 1 ) AND Day() > 14  AND
> Day() < 22,True,False);
>  
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
>>  
>> ----- Original Message -----
>>  
>> From:  Terry <mailto:MagicTH@xxxxxxxxxxx>
>>  
>> To: amibroker@xxxxxxxxxxxxxxx
>>  
>> Sent: Monday, August 09, 2004 4:03  PM
>>  
>> Subject: Re: [amibroker] attn: optoins  players ----- new feature suggestedto
>> AB
>>  
>> 
>> Gary,
>> 
>> Thanks for the suggestion, but I cannot  make it work. Seems to me this would
>> require recursion which is not allowed  with AB functions or it requires a
>> loop for which I cannot find non-array  functions such as Day, Date,
>> DayOfWeek.
>> 
>> Signed  Stumped.
>> --
>> 
>>  
>>> Terry,
>>>  
>>> If the trade day is null (ie.  doesn't exist, just test for null and assign
>>> the alternate expiration  date.
>>>  
>>> Regards,
>>> Gary
>>> 
>>> Terry  <MagicTH@xxxxxxxxxxx> wrote:
>>>  
>>>> I searched  PureBytes archives for a formula to detect options expiration
>>>> dates...none  found. I have the following, but it does not find expiration
>>>> weeks that do  not have a trade on Friday as in April, 2003 (for ^OEX). Any
>>>> suggestions?
>>>> 
>>>> expiry = IIf(DayOfWeek()==5 AND Day() > 14  AND Day()  <  22,True,False);
>> 
>> 
>> Check  AmiBroker web page at:
>> http://www.amibroker.com/
>> 
>> Check  group FAQ at:
>> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> 
>> 
>> 
>> 
>> Check AmiBroker web page at:
>> http://www.amibroker.com/
>> 
>> Check group FAQ at:
>> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> 
>> 
>> Yahoo! Groups Sponsor
>>  
>>  ADVERTISEMENT
>>  
>> <http://us.ard.yahoo.com/SIG=129o37vvk/M=298184.5285298.6392945.3001176/D=gro
>> ups/S=1705632198:HM/EXP=1092149290/A=2164330/R=0/SIG=11eamf8g4/*http://www.ne
>> tflix.com/Default?mqso=60183350>
>> 
>> 
>> Yahoo! Groups Links
>> * To visit your group on the web, go to:
>> * http://groups.yahoo.com/group/amibroker/
>> *  
>> * To unsubscribe from this group, send an email to:
>> * amibroker-unsubscribe@xxxxxxxxxxxxxxx
>> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>> *  
>> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
>> <http://docs.yahoo.com/info/terms/> .
>> 


-- 
Terry



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/