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@xxxxxxxxxxxxxxx, "J. Biran" <jbiran@xxx> 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@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
>> Behalf Of Dennis Brown
>> Sent: Friday, May 04, 2007 8:33 PM
>> To: amibroker@xxxxxxxxxxxxxxx
>> 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@xxxxxxxxxxxxxxx, "brian_z321" <brian_z321@>
>> wrote:
>> >>
>> >> --- In amibroker@xxxxxxxxxxxxxxx, "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@xxxxxxxxxxxxxxx
> mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
> <*> 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/
>
__._,_.___
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
SPONSORED LINKS
__,_._,___
|