Search the web
Sign In
New User? Sign Up
amibroker · AmiBroker User's List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
AmiBroker 4.94.0 BETA released   Message List  
Reply | Forward Message #110096 of 143804 |
RE: [amibroker] AFL Challenging: find yesterday's system data

Hi Herman
The Algorithm is reasonably straight forward, it may however be tricky in some part to implement it
Here it goes
1. Convert datenum to a linear continuous time scale. The most popular one is Rata Die time Format. I'll attach the code at the end of this post.
2. move back one day
3. if its either weekend or holiday move back two or one day respectively
4. repeat step 3 until all holidays/weekend
5. convert it back to datenum
 
Now holidays can sometimes be a little tricky, some fall on weekends and especially easter. Fortunately, there are plenty of codes out on the internet for calculating easter. one of them is http://archive.ely.anglican.org/etc/easter2.c which can be readily converted into a dll. this site should give you the holidays you need http://www.timeanddate.com/calendar/
 
here is the code for RatDie Date Format conversion, iRataDie only converts to yy mm dd at the moment, but can be convert to datenum quickly.
Let me know how you get on.

function RataDie(dnum)

// converts date to the Rata Die format

// yyyy - the year

// mm - the month

// dd - the day of the month

// http://www.decimaltime.hynes.net/dates.html#rd

{

num = dnum /10000; //year and month

yyyy = int(num) + 1900;

num = frac(num) * 100; // month and day

mm = int(num);

dd = frac(num)*100;

yyyy = yyyy + int((mm-14)/12);

mm = IIf(mm < 3, mm+12, mm);

rd = dd + int((153*mm-457)/5) + 365*yyyy + int(yyyy/4) - int(yyyy/100) + int(yyyy/400) - 306;

return (rd);

}

global dd, mm, yr;

function iRataDie(rd)

{

z = rd + 306;

g = z - 0.25;

a = int(G/36524.25);

b = a - int(A/4);

yr = int((b + g)/365.25);

Cc = b + z - int(365.25 * yr);

mm = int((5 * Cc + 456)/153);

dd = Cc - int((153*mm-457)/5);

yr = IIf(mm > 12, yr + 1, yr);

mm = IIf(mm > 12, mm - 12, mm);

return yr;

}

 



From: amibroker@yahoogroups.com [mailto:amibroker@yahoogroups.com] On Behalf Of Herman
Sent: Monday, 7 May 2007 7:52 AM
To: AmiBroker
Subject: [amibroker] AFL Challenging: find yesterday's system data

since there has been some talk about solving riddles using AFL one of you gurus might be in the mood to look at my problem: In my AT system I need to know the datenum for the previous trading day (Mon-Fri OK) using my system datetime as reference, i.e i should get that datenum even if I have no data for that day.


TIA,herman.


I got this far:


// Leap year:

//  1. Every Year divisible by 4 is a leap Year.

//  2. But every Year divisible by 100 is NOT a leap Year

//  3. Unless the Year is also divisible by 400, then it is still a leap Year.


SysDateNum        = Now(3);

SysYear         = int(SysDateNum/10000)+1900;                                 

LeapYear         = ( SysYear%4 == 0 AND SysYear%100 != 0 ) OR SysYear%400 == 0;

SysMonth        = int(SysDateNum/100)%100;

if( LeapYear ) DaysInMonth = "31,29,31,30,31,30,31,31,30,31,30,31";

else DaysInMonth = "31,28,31,30,31,30,31,31,30,31,30,31";


Title = "\n"+WriteIf(LeapYear,"LeapYear","NOT a LeapYear")+

", "NumToStr(SysYear,1.0,False)+"\n"+

"#Days in Month: "+DaysInMonth+"\n"+

"  Month Number: "+NumToStr(SysMonth,1.0,False);



Monday, May 7, 2007, 1:33:24 AM, you wrote:


> Joseph's answer is correct.


> Gosh ! I thought that I would just illustrate the utility and

> flexibility of .afl  - all without revealing my super secret and

> extremely profitable trading system. :>)


> A more complete set of rules:

> 1. E, L, F, O are integers in the range 0 to 9.

> 2. E != L != F != O

> 3. The O is a letter, not the number zero.

> 4. Yahoo! does compress out all of the white spaces, making the

> columns mis-align.  It is supposed to be the sum of 2 - 3 digit

> numbers equaling a 4 digit number.


> At the risk of turning this into a monster of off topic discussion -

> here's another


> EGG + EGG = PAGE 


> I won't post the code for this, although the code from the first

> posting can be easily modified to get the answer - showing the

> operation of array indexes, nested loops and the operation of the if

> statement.


> ReefBreak 

>  


> --- In amibroker@yahoogroups.com, "J. Biran" <jbiran@...> wrote:


>> I think the answer is much simpler:

>> F in the result has to be 1 (carry), the rest is automatic

>>  

>>    ELF                 721

>>  + ELF                 721

>> ________         _______


>>   FOOL                1442




>> Joseph Biran

>> ____________________________________________



>> -----Original Message-----

>> From: amibroker@yahoogroups.com [mailto:amibroker@yahoogroups.com] On

>> Behalf Of Dennis Brown

>> Sent: Friday, May 04, 2007 8:33 PM

>> To: amibroker@yahoogroups.com

>> Subject: Re: [amibroker] Re: AmiBroker 4.94.0 BETA released


>> LOL,


>> The brute force solution in AFL.  I have solved many problems this  

>> way with BASIC, APL, etc.


>> However, looking at this problem, it looks more like a logic problem  

>> than a math problem.


>> You get a big hint because:

>> F+0 = L therefore L= F

>> E +0 +carry = F therefore E = F - 1

>> substituting you get:

>>   c       c

>>   F-1   F      F

>>            F-1  F    F

>> ---------------------

>> F     2F    2F    F


>> to make a carry:  2F > 10  therefore F>4 and O = 2F-10

>> L&F = 5, E = 4, O = 0

>> L&F = 6, E = 5, O = 2

>> L&F = 7, E = 6, O = 4

>> L&F = 8, E = 7, O = 6

>> L&F = 9, E = 8, O = 8


>> Fun one,

>> Dennis



>> On May 4, 2007, at 10:15 PM, Ed Hoopes wrote:


>> > AFL a powerful and flexible language  -  YES !

>> >

>> > A math teacher friend of mine gave me the following problem:

>> >

>> >    ELF

>> >  + ELF

>> > ________

>> >

>> >   FOOL

>> >

>> > Each letter is an integer variable over the range 0 - 9.

>> > Find the values of E, L, F, O.

>> >

>> > After contemplating solving 4 equations in 4 unknowns, I decided to

>> > solve it by brute force with AFL.  Coded as follows:

>> >

>> > //     elf

>> > //   + elf

>> > //_______

>> > //    fool

>> >

>> > for (eee = 0; eee < 10; eee++)

>> >     {

>> >     for ( lll = 0; lll < 10; lll = lll + 2 )

>> >     {

>> >     for( fff = 0; fff < 10; fff++ )

>> >     {

>> >     elf = 100 * eee + 10 * lll + fff ;

>> >     for (ooo = 0; ooo < 10; ooo++ )

>> >     {

>> >     fool = 1000*fff + 100*ooo + 10*ooo + lll;

>> >     if(2*elf[fff] == fool[ooo])

>> >     printf("eee= " + eee + " lll= " + lll + " fff= " + fff + "

>> ooo= " +

>> > ooo + "\n" ) ;

>> >     else

>> >     xxx=0 ;

>> >     }

>> >     }

>> >     }

>> >     }

>> >

>> > Excuse the wrapping.

>> >

>> > AFL is GREAT !

>> >

>> > ReefBreak

>> >

>> > --- In amibroker@yahoogroups.com, "brian_z321" <brian_z321@>

>> wrote:

>> >>

>> >> --- In amibroker@yahoogroups.com, "jim_trades_stocks" <jnk1997@>

>> >> wrote:

>> >>>

>> >>> Forget about trading, making money...Baaah!, no time for that!

>> >>>

>> >>> Your mission is to keep up with the advanced functions,

>> >> capabilities

>> >>> and coding of Amibroker for a lifetime adventure of backtesting

>> and

>> >>> viewing theoretical equity curves.

>> >>>

>> >>> I Guess the new evolutionary "AFL Wizard" didn't make it within 2

>> >>> months as was promised.

>> >>

>> >> Jim,

>> >>

>> >> No one knows how to push peoples buttons more than a sales

>> executive.

>> >>

>> >> So you want your Formula Wizard and you want it now and you mounted

>> a

>> >> public campagn to bustle Tomasz into doing it?

>> >>

>> >> I am a goer myself so I have a sneaking regard for others who have

>> >> balls  

>> >>

>> >> Perhaps you, and others, should consider the affect that this

>> public

>> >> and constant tearing away at Tomasz's persona has on him.

>> >>

>> >> He is a brilliant person but he is also human, just like us.

>> >>

>> >> On top of that you divert Tomasz's attention away from productive

>> >> tasks and the same applies to group members who have to come in and

>> >> post to provide some balance.

>> >>

>> >> Also, I think you will find  there are better ways to get what you

>> >> want without the need for public blustering.

>> >>

>> >> I am an aggressive person but I have learnt that controlled

>> >> aggression, proactively directed, is the way to use that energy

>> >> constructively; sport is the arena where this is most apparent to

>> any

>> >> observer.

>> >>

>> >> As I said in another post, I have found Tomasz very approachable,

>> yes

>> >> even susceptible, to a well presented private petition.

>> >>

>> >>

>> >> FTR

>> >>

>> >> I have been a persistent and strong campaigner on user easy

>> features

>> >> since I joined the Ami forum but a Formula Wizard does not get my

>> >> vote.

>> >> I have used them in other programs and they just don't do anything

>> >> for me.

>> >> However if Tomasz wants to do it there will be no complaints from

>> me.

>> >>

>> >> The reason?

>> >>

>> >> I trust Tomasz's ability to steer the ship, and, aside from

>> offering

>> >> no strings attached suggestions here and there I leave him to get

>> on

>> >> with his job and I get on with mine.

>> >>

>> >> 55 years old has nothing to do with it.

>> >> Neither does *I am not trained in programming or computers*

>> >> *I have a full time job and a family to care for* has a lot to do

>> >> with it.

>> >>

>> >> I empathise with the fact that you are a road warrior; a tough

>> career

>> >> choice.

>> >>

>> >> All the best for your career and your trading,

>> >>

>> >> Brian.

>> >>

>> >

>> >

>> >

>> >

>> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:

>> > http://www.amibroker.com/devlog/

>> >

>> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:

>> http://www.amibroker.com/devlog/


>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:

> http://www.amibroker.com/devlog/


> For other support material please check also:

> http://www.amibroker.com/support.html

>  

> Yahoo! Groups Links


> <*> To visit your group on the web, go to:

>     http://groups.yahoo.com/group/amibroker/


> <*> Your email settings:

>     Individual Email | Traditional


> <*> To change settings online go to:

>     http://groups.yahoo.com/group/amibroker/join

>     (Yahoo! ID required)


> <*> To change settings via email:

>     mailto:amibroker-digest@yahoogroups.com 

>     mailto:amibroker-fullfeatured@yahoogroups.com


> <*> To unsubscribe from this group, send an email to:

>     amibroker-unsubscribe@yahoogroups.com


> <*> Your use of Yahoo! Groups is subject to:

>     http://docs.yahoo.com/info/terms/

>  



Mon May 7, 2007 1:23 am

paultsho
Offline Offline
Send Email Send Email

Forward
Message #110096 of 143804 |
Expand Messages Author Sort by Date

I want to thank you for a great DLL which I have been using for a long time now. Any updates/additions to this utility would be very welcome. Even if holiday...
J. Biran
jbiran
Offline Send Email
May 8, 2007
5:34 am

Hi Herman The Algorithm is reasonably straight forward, it may however be tricky in some part to implement it Here it goes 1. Convert datenum to a linear...
Paul Ho
paultsho
Offline Send Email
May 7, 2007
1:25 am

Thanks for everyone's feedback. Thanks Paul, for the Rata Die conversions (was new to me) it is quite useful. Below is the working code, bit rough still but I...
Herman
psytek2
Offline Send Email
May 7, 2007
9:03 am

Maybe I'm missing something ... But wouldn't it be simpler to pick up datenum() from a previous bar of some standard data stream ?...
Fred
fctonetti
Offline Send Email
May 7, 2007
11:13 am

doesn't work if you don't have data, its a long story but in RT/AT you cannot depend on data. best regards, herman...
Herman
psytek2
Offline Send Email
May 7, 2007
11:27 am

EGG 899 + EGG + 899 _____ _____ PAGE 1798 Joseph Biran ... From: amibroker@yahoogroups.com [mailto:amibroker@yahoogroups.com] On Behalf Of Ed Hoopes ...
J. Biran
jbiran
Offline Send Email
May 6, 2007
10:57 pm

I have used Amibroker for a number of years and have been a member of this list also. I know that a program like this can have a learning curve but if you are...
James Hutchison
phutch_2001
Offline Send Email
May 7, 2007
2:24 am

Brian, I did not mount a public campaign, this is a forum that Tomasz replies promptly to. Tomasz "told me off" (in my opinion) on another Amibroker board when...
jim_trades_stocks
jim_trades_s...
Offline Send Email
May 7, 2007
3:55 pm

Told you off ? ... or ... responded to your question ? ... Maybe I'm missing something but I don't see any overpromising or underdelivering, but then again...
Fred
fctonetti
Offline Send Email
May 7, 2007
5:24 pm

... wrote: Jim, I appreciate your candour and respect you for sticking up for yourself. I don't see Tomasz as having a sarcastic, curt or arrogant bone in his...
brian_z321
Offline Send Email
May 7, 2007
10:20 pm

... Trust me... When Tomasz 'tells you off', you will know it! His reply to you was businesslike and polite. This forum has been around for over 5 years, and...
Phsst
Offline Send Email
May 8, 2007
12:20 am

Jim, Well, there are lots of sayings that apply to your post as: "No good deed goes unpunished" or "You can please some of the people some of the time, but you...
Tomasz Janeczko
amibroker
Offline Send Email
May 3, 2007
9:18 pm

... Tomasz, I got a chuckle from your comment. My own programming estimates are usually optimistic as well. From past experience, if I make an estimate and...
Nick Busigin
tradernickb
Offline Send Email
May 4, 2007
3:48 am

GREAT!! Joseph Biran ____________________________________________ _____ From: amibroker@yahoogroups.com [mailto:amibroker@yahoogroups.com] On Behalf Of Tomasz...
J. Biran
jbiran
Offline Send Email
May 3, 2007
9:29 pm

Tomasz, thanks for the upgrades.... Can we draw a Bell Curve with the new low-level graphics....If yes, could you please give an example formula.... Thank you...
Anthony Faragasso
ajf1111us2000
Offline Send Email
May 3, 2007
9:29 pm

... Tomasz, thanks for the upgrades...
lanbor
boris_kanevsky
Offline Send Email
May 3, 2007
10:35 pm

The new graphing potential will keep me busy for another month :-) Good stuff TJ! herman...
Herman
psytek2
Offline Send Email
May 3, 2007
9:33 pm

What are the units of X,Y coordinates in the new low level graphics commands: barnumber/price, absolute x/y pixels relative percent of window size? (i.e....
J. Biran
jbiran
Offline Send Email
May 3, 2007
9:50 pm

Hello, All low-level graphic functions use PIXELS as unit. Use Status("pxwidth") and Status("pxheight") to find out the pixel dimensions of window pane. About...
Tomasz Janeczko
amibroker
Offline Send Email
May 3, 2007
10:39 pm

Apologies for what may be a dumb question from a non-programmer, but is it possible to use GfxSelectFont and GfxTextOut as a more powerfull version of...
ricardo_tip
Offline Send Email
May 4, 2007
11:50 pm

Yes you can. I can give you an example if only you tell me of what distribution you would like to display. Best regards, Tomasz Janeczko amibroker.com ... ...
Tomasz Janeczko
amibroker
Offline Send Email
May 3, 2007
10:39 pm

Tomasz, Anthony may have something more specific in mind but a sample using ATC and any range bound indicator (RSI, Stoch, etc) or something with the CBT in a...
Duke Jones, CMT
sectorfund
Offline Send Email
May 4, 2007
1:43 pm

You forgot "new look" of charts - clearer display and more space for charts - that is just what you receive without any coding. You just install upgrade and...
Tomasz Janeczko
amibroker
Offline Send Email
May 3, 2007
10:48 pm

I'm using AQ 1.94 and AB 4.94. I get my EOD from Yahoo, server #2 but i've tried the other servers. All my volumes are divided by 100. for QQQQ, yesterday...
ron
r194ondi
Offline Send Email
May 9, 2007
3:36 pm

Maybe this: File >> Database Setting >> Configure >> Options >> Divide Volume Bill ... From: "ron" <r194ondi@...> To: <amibroker@yahoogroups.com> Sent:...
wavemechanic
wd13x6
Offline Send Email
May 9, 2007
4:33 pm

Thanks for the quick reply Bill. I'm dealing with EOD only, US Stocks. When i click Configure, a get a popup which says: Local Database does not need further...
ron
r194ondi
Offline Send Email
May 9, 2007
6:04 pm

Check formats for AQD and AQH. These are files in formats and tell AQ how to download data. $VOLFACTOR is the command you are looking for. Its probably set at...
David Fitch
dave9542
Offline Send Email
May 10, 2007
1:53 am

That was it David-- both file had $VOLFACTOR set to 0.01. I never changed that--- after all these years how do you suppose that got changed? thanks again, ron...
ron
r194ondi
Offline Send Email
May 10, 2007
4:14 am

This,I believe , was changed in defaults to accomodate large volumes that become truncated...check indexes, some will max out. By shifting decimal point these...
David Fitch
dave9542
Offline Send Email
May 10, 2007
4:35 am

Hi Tomasz Is the problem relating to aliases not recognised in watchlist import fixed in this release /Paul....
Paul Ho
paultsho
Offline Send Email
May 4, 2007
12:49 am
 First  |  |  Last 
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help