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

RE: [amibroker] Example using functions in MathLib (for Jayson)



PureBytes Links

Trading Reference Links




Thanks 
Chuck,
<SPAN 
class=640045920-07052003> 
My 
questions were aimed at developing my own functions and I think you answered my 
questions. I will do some experimenting. If you decide to add array to the 
function please share it so I can compare the syntax.
 
Regards,
 
Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Chuck Rademacher 
[mailto:chuck_rademacher@xxxxxxxxxx]Sent: Wednesday, May 07, 2003 
4:42 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] Example using functions in MathLib (for Jayson)
<FONT color=#0000ff face=Arial 
size=2> 
I'm 
lost, Jayson, sorry.
<FONT color=#0000ff face=Arial 
size=2> 
Are 
you interested in writing functions or using the functions I 
uploaded?
<FONT color=#0000ff face=Arial 
size=2> 
To use 
RSquared, you don't even have to look at it.  I've documented the fact that 
you only pass the number of bars and it returns the value of the 
function.
<FONT color=#0000ff face=Arial 
size=2> 
If you 
are asking me how to write a function, you can have as many "things" being 
passed to the function as you want.   As long as the AFL calling the 
function and the function itself agree on how many parameters are being passed 
and in what order, everything is peachy.
<FONT color=#0000ff face=Arial 
size=2> 
I 
could have written the function like this:
<FONT color=#0000ff face=Arial 
size=2> 
<FONT color=#0000ff face=Arial 
size=2>function crLinearCorrelation (crArray, crLength);
<FONT color=#0000ff face=Arial 
size=2> 
I may, 
in fact, change it to that form in case someone wants to use the function on 
something other than the closing price.   If I wrote it that way, then 
the AFL calling it has to pass two, corresponding parameters to 
it.
<FONT color=#0000ff face=Arial 
size=2> 
<FONT color=#0000ff face=Arial 
size=2>Finally, you can return only one value and that is achieved with the 
"return" statement as you have noted below.
<FONT color=#0000ff face=Arial 
size=2> 
I'm 
happy to help, but I'm not sure whether you are seeking assistance with 
using my functions or writing your own.   If you want help with 
writing one, just make an attempt at it and send it to me for 
comment.   You'll get comments and assistance from others, 
too.
<BLOCKQUOTE 
>
  <FONT face="Times New Roman" 
  size=2>-----Original Message-----From: Jayson 
  [mailto:jcasavant@xxxxxxxxxxxx]Sent: Wednesday, May 07, 2003 4:22 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
  Example using functions in MathLib (for Jayson)
  <SPAN 
  class=611563119-07052003>Thanks Chuck,
  <SPAN 
  class=611563119-07052003> 
  <SPAN 
  class=611563119-07052003>Forgive me the rudimentary questions and please 
  correct me if I am wrong. First you declare the function with  
  
  <FONT 
  face=Arial>
  function crLinearCorrelation (crLength) 
  
  then 
  you make your calculations with in the {   } and you base the 
  results of the function with your IIf statement and the result of the 
  calculations you call with..<SPAN 
  class=611563119-07052003>
  return <FONT 
  color=#0000ff>IIf(crLowEQT == <FONT 
  color=#ff00ff>0, <FONT 
  color=#ff00ff>0, crUpEQ / crLowEQT);
  Is it always assumed 
  that following the function name  (crLinearCorrelation ) that the next 
  argument is a period 
  (crlength)??
   
  Regards,
   
  Jayson 
  <FONT face=Tahoma 
  size=2>-----Original Message-----From: Chuck Rademacher 
  [mailto:chuck_rademacher@xxxxxxxxxx]Sent: Wednesday, May 07, 2003 
  3:22 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
  Example using functions in MathLib (for Jayson)
  <FONT color=#0000ff face=Arial 
  size=2>Jayson...
  <FONT color=#0000ff face=Arial 
  size=2> 
  <FONT color=#0000ff face=Arial 
  size=2>Perhaps you missed another posting on the subject.
  <FONT color=#0000ff face=Arial 
  size=2> 
  Here 
  is an example using R-Squared that you might have in a trading 
  system:
  <FONT color=#0000ff face=Arial 
  size=2> 
  <FONT color=#0000ff face=Arial 
  size=2>#INCLUDE  
  "........................./crMathLib.afl";
  <FONT color=#0000ff face=Arial 
  size=2>..
  Buy 
  = LinRegSlope > 0 and crRSquared(20) > 0.80;
  Sell 
  = LinRegSlope < 0 and crRSquared(20) > 0.80;
  <FONT color=#0000ff face=Arial 
  size=2> 
  <FONT color=#0000ff face=Arial 
  size=2> 
  or, 
  you might just want to graph R-Squared:
  <FONT color=#0000ff face=Arial 
  size=2> 
  <FONT color=#0000ff face=Arial 
  size=2>graph(0) = crRSquared(20);
  <FONT color=#0000ff face=Arial 
  size=2> 
  <FONT color=#0000ff face=Arial 
  size=2> 
  <FONT color=#0000ff face=Arial 
  size=2> 
  <BLOCKQUOTE 
  >
    <FONT face="Times New Roman" 
    size=2>-----Original Message-----From: Jayson 
    [mailto:jcasavant@xxxxxxxxxxxx]Sent: Wednesday, May 07, 2003 9:01 
    AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
    [amibroker] New math functions added to AFL library 
    (AmiBroker.com)
    <SPAN 
    class=666545812-07052003>Chuck,
    <SPAN 
    class=666545812-07052003>Thanks for sharing this. Could perhaps post an 
    example afl  showing the use of one or both?
     
    Regards,
     
    Jayson 
    <FONT face=Tahoma 
    size=2>-----Original Message-----From: Chuck Rademacher 
    [mailto:chuck_rademacher@xxxxxxxxxx]Sent: Tuesday, May 06, 2003 
    3:57 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
    [amibroker] New math functions added to AFL library 
    (AmiBroker.com)
    <FONT color=#0000ff face=Arial 
    size=2>I've just uploaded a (very) small library of math functions to the 
    AFL library at AmiBroker.com.  It is a "work in progress" 
    library and this first posting is purely to get things going.  
    More functions will be added regularly.  Users may cut and paste 
    functions into their own code.  The name of the file is crMathLib.afl 
    and the current version only includes:
     
    <FONT color=#0000ff face=Arial 
    size=2>crLinearCorrelation (bars)
     
    <FONT color=#0000ff face=Arial 
    size=2>crRSquare (bars)Send BUG REPORTS to 
    bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS 
    to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 
  SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 
  Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 
Send 
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor












Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.