NB. I just thought somebody would like to see the results of your help. NB. First I create wildly stock open/close/hi/low data.
openData =: 1 2 3 4 5 6 7 8 9 closeData =: 10 20 30 40 50 60 70 80 90 highData =: 15 25 35 45 55 65 75 85 95 lowData =: 1 2 3 4 5 6 7 8 9 NB. Now I create the vectors so they represent the correct data. Oi =: }. openData Ci =: }. closeData Ci_1 =: }: closeData Hi =: }. highData Li =: }. lowData ln =: ^. NB. produce natural log of a number k =: 0.34 % ( 1 + ( ( n + 1 ) % ( n - 1 ))) NB. OK rho2_rs =: ( Z % n ) * ( +/ ((ln( Hi % Ci)) * (ln( Hi % Oi ))) + ( ln (Li % Ci)) * ( ln ( Li % Oi))) u_close =: ( 1 % n) * ( +/ ln ( Ci % Oi)) rho2_close =: (Z %( n-1)) * ( +/ *: ( ln ( Ci % Oi) - u_close )) u_open =: (1 % n ) * ( +/ (ln Oi % Ci_1)) rho2_open_square =: (Z % ( n - 1 )) * ( +/ *: ( ln (( Oi ) % ( Ci_1 )))) rho_squared =: rho2_open_square + ( k * rho2_close ) + (( 1 - k) * rho2_rs) NB. Thanks... See Http://www.sitmo.com/eq/417 for the equations. ----- Original Message Follows ----- From: [EMAIL PROTECTED] To: [email protected] Subject: Programming Digest, Vol 21, Issue 12 Date: Thu, 7 Jun 2007 22:35:18 +0800 (HKT) >Send Programming mailing list submissions to > [email protected] > >To subscribe or unsubscribe via the World Wide Web, visit > >http://www.jsoftware.com/cgi-bin/mailman/listinfo/programming >or, via email, send a message with subject or body 'help' >to > [EMAIL PROTECTED] > >You can reach the person managing the list at > [EMAIL PROTECTED] > >When replying, please edit your Subject line so it is more >specific than "Re: Contents of Programming digest..." > > >Today's Topics: > > 1. Re: tactic programming (Raul Miller) > 2. Re: tactic programming (Mike Day) > 3. Re: tactic programming (Mike Day) > 4. Re: tactic programming (Mike Day) > 5. Re: tactic programming (R.A. MacDonald) > 6. Re: tactic programming (R.A. MacDonald) > 7. Re: tactic programming (Roger Hui) > 8. Re: tactic programming (Mike Day) > > >----------------------------------------------------------- >----------- > >Message: 1 >Date: Thu, 7 Jun 2007 00:34:47 -0400 >From: "Raul Miller" <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: "Programming forum" <[email protected]> >Message-ID: > ><[EMAIL PROTECTED] >m> Content-Type: text/plain; charset=ISO-8859-1; >format=flowed > >On 6/7/07, [EMAIL PROTECTED] >> <[EMAIL PROTECTED]> wrote: Given: >> open =: 100 101 103 104 103 102 >> close =: 101 100 104 104 105 103 >> how about >> +/ open(index+1) % close(index) > >Perhaps you mean > +/ (}.open) % }:close >? > >If not, could you specify more precisely what it is that >you mean? > >Thanks, > >-- >Raul > > >------------------------------ > >Message: 2 >Date: Thu, 07 Jun 2007 07:54:02 +0100 >From: Mike Day <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: Programming forum <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Dear J Language > >Raul's is what you want if you're happy with >an explicit answer. However, if by "tactic" >you mean "tacit" then this might be what you >want. > >NB. Given > open =: 100 101 103 104 103 102 > close =: 101 100 104 104 105 103 > >NB. make a 2-row matrix using ,: "laminate" > open (,:)close >100 101 103 104 103 102 >101 100 104 104 105 103 > >NB. study use of u/. "oblique" ... > open (%//.@:,:)close >100 1 1.03 1 0.990385 0.971429 103 > >NB. clean up ends if you need to ... > open ([EMAIL PROTECTED]:@(%//.@:,:))close >1 1.03 1 0.990385 0.971429 > >NB. If the quotes are columns in a table, >NB. eg (for your example) ... > tab=:(open,.close)1 4}"1(100+?6 5$ 6) > >NB. you can do this sort of thing... > ([EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >1 1.03 1 0.990385 0.971429 > >Mike > > > >Raul Miller wrote: >> On 6/7/07, [EMAIL PROTECTED] >>> <[EMAIL PROTECTED]> wrote: Given: >>> open =: 100 101 103 104 103 102 >>> close =: 101 100 104 104 105 103 >>> how about >>> +/ open(index+1) % close(index) >> >> Perhaps you mean >> +/ (}.open) % }:close >> ? >> >> If not, could you specify more precisely what it is that >> you mean? >> >> Thanks, >> > > >------------------------------ > >Message: 3 >Date: Thu, 07 Jun 2007 07:59:44 +0100 >From: Mike Day <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: Programming forum <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >[re-sent for readability - Thunderbird had removed >some line throws. There'll be some extra line padding >now - I think!] > >Dear J Language > >Raul's is what you want if you're happy with >an explicit answer. However, if by "tactic" >you mean "tacit" then this might be what you >want. > >NB. Given > open =: 100 101 103 104 103 102 > close =: 101 100 104 104 105 103 > >NB. make a 2-row matrix using ,: "laminate" > > open (,:)close > >100 101 103 104 103 102 >101 100 104 104 105 103 > >NB. study use of u/. "oblique" ... > > open (%//.@:,:)close > >100 1 1.03 1 0.990385 0.971429 103 > >NB. clean up ends if you need to ... > > open ([EMAIL PROTECTED]:@(%//.@:,:))close > >1 1.03 1 0.990385 0.971429 > >NB. If the quotes are columns in a table, >NB. eg (for your example) ... > tab=:(open,.close)1 4}"1(100+?6 5$ 6) > >NB. you can do this sort of thing... > ([EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >1 1.03 1 0.990385 0.971429 > >Mike > > > >Raul Miller wrote: >> On 6/7/07, [EMAIL PROTECTED] >>> <[EMAIL PROTECTED]> wrote: Given: >>> open =: 100 101 103 104 103 102 >>> close =: 101 100 104 104 105 103 >>> how about >>> +/ open(index+1) % close(index) >> >> Perhaps you mean >> +/ (}.open) % }:close >> ? >> >> If not, could you specify more precisely what it is that >> you mean? >> >> Thanks, >> > > >------------------------------ > >Message: 4 >Date: Thu, 07 Jun 2007 08:05:50 +0100 >From: Mike Day <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: Programming forum <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Sorry, I forgot to add the add: > > open (+/@[EMAIL PROTECTED]:@(%//.@:,:))close > >4.99181 > > (+/@[EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab > >4.99181 > >Mike > >Mike Day wrote: >> [re-sent for readability - Thunderbird had removed >> some line throws. There'll be some extra line padding >> now - I think!] >> >> Dear J Language >> >> Raul's is what you want if you're happy with >> an explicit answer. However, if by "tactic" >> you mean "tacit" then this might be what you >> want. >> >> NB. Given >> open =: 100 101 103 104 103 102 >> close =: 101 100 104 104 105 103 >> >> NB. make a 2-row matrix using ,: "laminate" >> >> open (,:)close >> >> 100 101 103 104 103 102 >> 101 100 104 104 105 103 >> >> NB. study use of u/. "oblique" ... >> >> open (%//.@:,:)close >> >> 100 1 1.03 1 0.990385 0.971429 103 >> >> NB. clean up ends if you need to ... >> >> open ([EMAIL PROTECTED]:@(%//.@:,:))close >> >> 1 1.03 1 0.990385 0.971429 >> >> NB. If the quotes are columns in a table, >> NB. eg (for your example) ... >> tab=:(open,.close)1 4}"1(100+?6 5$ 6) >> >> NB. you can do this sort of thing... >> ([EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >> 1 1.03 1 0.990385 0.971429 >> >> Mike >> >> >> >> Raul Miller wrote: >>> On 6/7/07, [EMAIL PROTECTED] >>>> <[EMAIL PROTECTED]> wrote: Given: >>>> open =: 100 101 103 104 103 102 >>>> close =: 101 100 104 104 105 103 >>>> how about >>>> +/ open(index+1) % close(index) >>> >>> Perhaps you mean >>> +/ (}.open) % }:close >>> ? >>> >>> If not, could you specify more precisely what it is that >>> you mean? >>> >>> Thanks, >>> >> >----------------------------------------------------------- >> ----------- For information about J forums see >>http://www.jsoftware.com/forums.htm >> > > >------------------------------ > >Message: 5 >Date: Thu, 07 Jun 2007 10:49:53 -0300 >From: "R.A. MacDonald" <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: Programming forum <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Hello Mike; > >I suspect that Raul was misled by the use of '+/ open % >close' as a solution. > >The solution Raul proposed does tug at my (Browningian?) >yearning at a phrasal form that does: > > (f x) g (h y) > >and is not as cluttered as > > ([: f [)g([: h]) > > > >Mike Day wrote: >> Dear J Language >> >> Raul's is what you want if you're happy with >> an explicit answer. However, if by "tactic" >> you mean "tacit" then this might be what you >> want. >> >> NB. Given >> open =: 100 101 103 104 103 102 >> close =: 101 100 104 104 105 103 >> >> NB. make a 2-row matrix using ,: "laminate" >> open (,:)close 100 101 103 104 103 102 >> 101 100 104 104 105 103 >> >> NB. study use of u/. "oblique" ... >> open (%//.@:,:)close 100 1 1.03 1 0.990385 0.971429 103 >> >> NB. clean up ends if you need to ... >> open ([EMAIL PROTECTED]:@(%//.@:,:))close >> 1 1.03 1 0.990385 0.971429 >> >> NB. If the quotes are columns in a table, >> NB. eg (for your example) ... >> tab=:(open,.close)1 4}"1(100+?6 5$ 6) >> >> NB. you can do this sort of thing... >> ([EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >> 1 1.03 1 0.990385 0.971429 >> >> Mike >> >> >> >> Raul Miller wrote: >>> On 6/7/07, [EMAIL PROTECTED] >>>> <[EMAIL PROTECTED]> wrote: Given: >>>> open =: 100 101 103 104 103 102 >>>> close =: 101 100 104 104 105 103 >>>> how about >>>> +/ open(index+1) % close(index) >>> >>> Perhaps you mean >>> +/ (}.open) % }:close >>> ? >>> >>> If not, could you specify more precisely what it is that >>> you mean? >>> >>> Thanks, >>> >> >----------------------------------------------------------- >> ----------- For information about J forums see >>http://www.jsoftware.com/forums.htm > >-- > >later ... >----------------------------------------------------------- >------------- |\/| Randy A MacDonald | APL: If you can >say it, it's done.. (ram) |/\| [EMAIL PROTECTED] | >|\ | | The only real problem with APL >is that BSc(Math) UNBF'83 | it is "still ahead of >its time." Sapere Aude | - Morten Kromberg > | Looking for a whip-smart APL >developer? Send me a note. Natual born APL'er | >mailto:[EMAIL PROTECTED] >-----------------------------------------------------(INTP) >----{ gnat }- > > > >------------------------------ > >Message: 6 >Date: Thu, 07 Jun 2007 10:54:01 -0300 >From: "R.A. MacDonald" <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: Programming forum <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Hello Mike; > >Does this work? > >open (([: }. [)(+/ . %)([: }: ])) close > >Mike Day wrote: >> Sorry, I forgot to add the add: >> >> open (+/@[EMAIL PROTECTED]:@(%//.@:,:))close >> >> 4.99181 >> >> (+/@[EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >> >> 4.99181 >> >> Mike >> >> Mike Day wrote: >>> [re-sent for readability - Thunderbird had removed >>> some line throws. There'll be some extra line padding >>> now - I think!] >>> >>> Dear J Language >>> >>> Raul's is what you want if you're happy with >>> an explicit answer. However, if by "tactic" >>> you mean "tacit" then this might be what you >>> want. >>> >>> NB. Given >>> open =: 100 101 103 104 103 102 >>> close =: 101 100 104 104 105 103 >>> >>> NB. make a 2-row matrix using ,: "laminate" >>> >>> open (,:)close >>> >>> 100 101 103 104 103 102 >>> 101 100 104 104 105 103 >>> >>> NB. study use of u/. "oblique" ... >>> >>> open (%//.@:,:)close >>> >>> 100 1 1.03 1 0.990385 0.971429 103 >>> >>> NB. clean up ends if you need to ... >>> >>> open ([EMAIL PROTECTED]:@(%//.@:,:))close >>> >>> 1 1.03 1 0.990385 0.971429 >>> >>> NB. If the quotes are columns in a table, >>> NB. eg (for your example) ... >>> tab=:(open,.close)1 4}"1(100+?6 5$ 6) >>> >>> NB. you can do this sort of thing... >>> ([EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >>> 1 1.03 1 0.990385 0.971429 >>> >>> Mike >>> >>> >>> >>> Raul Miller wrote: >>>> On 6/7/07, [EMAIL PROTECTED] >>>>> <[EMAIL PROTECTED]> wrote: Given: >>>>> open =: 100 101 103 104 103 102 >>>>> close =: 101 100 104 104 105 103 >>>>> how about >>>>> +/ open(index+1) % close(index) >>>> >>>> Perhaps you mean >>>> +/ (}.open) % }:close >>>> ? >>>> >>>> If not, could you specify more precisely what it is >>>> that you mean? >>>> >>>> Thanks, >>>> >>> >----------------------------------------------------------- >>> ----------- For information about J forums see >>>http://www.jsoftware.com/forums.htm >>> >> >----------------------------------------------------------- >> ----------- For information about J forums see >>http://www.jsoftware.com/forums.htm > >-- > >later ... >----------------------------------------------------------- >------------- |\/| Randy A MacDonald | APL: If you can >say it, it's done.. (ram) |/\| [EMAIL PROTECTED] | >|\ | | The only real problem with APL >is that BSc(Math) UNBF'83 | it is "still ahead of >its time." Sapere Aude | - Morten Kromberg > | Looking for a whip-smart APL >developer? Send me a note. Natual born APL'er | >mailto:[EMAIL PROTECTED] >-----------------------------------------------------(INTP) >----{ gnat }- > > > >------------------------------ > >Message: 7 >Date: Thu, 07 Jun 2007 07:05:09 -0700 >From: Roger Hui <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: Programming forum <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=us-ascii > >[EMAIL PROTECTED] g [EMAIL PROTECTED] is equivalent to ([: f [)g([: h]) >but is shorter and requires no parens. > > > >----- Original Message ----- >From: "R.A. MacDonald" <[EMAIL PROTECTED]> >Date: Thursday, June 7, 2007 6:49 am >Subject: Re: [Jprogramming] tactic programming > >> Hello Mike; >> >> I suspect that Raul was misled by the use of '+/ open % >> close' as a >> solution. >> >> The solution Raul proposed does tug at my (Browningian?) >> yearning at a >> phrasal form that does: >> >> (f x) g (h y) >> >> and is not as cluttered as >> >> ([: f [)g([: h]) > > >------------------------------ > >Message: 8 >Date: Thu, 07 Jun 2007 15:49:13 +0100 >From: Mike Day <[EMAIL PROTECTED]> >Subject: Re: [Jprogramming] tactic programming >To: Programming forum <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Randy > >Yes - though I do like the use of oblique on a table >here. Not so useful for offsets or lags other than >one time interval. > >Mike > >R.A. MacDonald wrote: >> Hello Mike; >> >> Does this work? >> >> open (([: }. [)(+/ . %)([: }: ])) close >> >> Mike Day wrote: >>> Sorry, I forgot to add the add: >>> >>> open (+/@[EMAIL PROTECTED]:@(%//.@:,:))close >>> >>> 4.99181 >>> >>> (+/@[EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >>> >>> 4.99181 >>> >>> Mike >>> >>> Mike Day wrote: >>>> [re-sent for readability - Thunderbird had removed >>>> some line throws. There'll be some extra line padding >>>> now - I think!] >>>> >>>> Dear J Language >>>> >>>> Raul's is what you want if you're happy with >>>> an explicit answer. However, if by "tactic" >>>> you mean "tacit" then this might be what you >>>> want. >>>> >>>> NB. Given >>>> open =: 100 101 103 104 103 102 >>>> close =: 101 100 104 104 105 103 >>>> >>>> NB. make a 2-row matrix using ,: "laminate" >>>> >>>> open (,:)close >>>> >>>> 100 101 103 104 103 102 >>>> 101 100 104 104 105 103 >>>> >>>> NB. study use of u/. "oblique" ... >>>> >>>> open (%//.@:,:)close >>>> >>>> 100 1 1.03 1 0.990385 0.971429 103 >>>> >>>> NB. clean up ends if you need to ... >>>> >>>> open ([EMAIL PROTECTED]:@(%//.@:,:))close >>>> >>>> 1 1.03 1 0.990385 0.971429 >>>> >>>> NB. If the quotes are columns in a table, >>>> NB. eg (for your example) ... >>>> tab=:(open,.close)1 4}"1(100+?6 5$ 6) >>>> >>>> NB. you can do this sort of thing... >>>> ([EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab >>>> 1 1.03 1 0.990385 0.971429 >>>> >>>> Mike >>>> >>>> >>>> >>>> Raul Miller wrote: >>>>> On 6/7/07, [EMAIL PROTECTED] >>>>>> <[EMAIL PROTECTED]> wrote: Given: >>>>>> open =: 100 101 103 104 103 102 >>>>>> close =: 101 100 104 104 105 103 >>>>>> how about >>>>>> +/ open(index+1) % close(index) >>>>> >>>>> Perhaps you mean >>>>> +/ (}.open) % }:close >>>>> ? >>>>> >>>>> If not, could you specify more precisely what it is >>>>> that you mean? >>>>> >>>>> Thanks, >>>>> >>>> >----------------------------------------------------------- >>>> ----------- For information about J forums see >>>>http://www.jsoftware.com/forums.htm >>>> >>> >----------------------------------------------------------- >>> ----------- For information about J forums see >>>http://www.jsoftware.com/forums.htm >> > > >------------------------------ > >----------------------------------------------------------- >----------- For information about J forums see >http://www.jsoftware.com/forums.htm > >End of Programming Digest, Vol 21, Issue 12 >******************************************* ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
