[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




<FONT face=Arial color=#0000ff 
size=2> 
I'm 
lost, Jayson, sorry.
<FONT face=Arial color=#0000ff 
size=2> 
Are 
you interested in writing functions or using the functions I 
uploaded?
<FONT face=Arial color=#0000ff 
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 face=Arial color=#0000ff 
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 face=Arial color=#0000ff 
size=2> 
I 
could have written the function like this:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>function crLinearCorrelation (crArray, crLength);
<FONT face=Arial color=#0000ff 
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 face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>Finally, you can return only one value and that is achieved with the 
"return" statement as you have noted below.
<FONT face=Arial color=#0000ff 
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 face=Arial color=#0000ff 
  size=2>Jayson...
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2>Perhaps you missed another posting on the subject.
  <FONT face=Arial color=#0000ff 
  size=2> 
  Here 
  is an example using R-Squared that you might have in a trading 
  system:
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2>#INCLUDE  
  "........................./crMathLib.afl";
  <FONT face=Arial color=#0000ff 
  size=2>..
  Buy 
  = LinRegSlope > 0 and crRSquared(20) > 0.80;
  Sell 
  = LinRegSlope < 0 and crRSquared(20) > 0.80;
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2> 
  or, 
  you might just want to graph R-Squared:
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2>graph(0) = crRSquared(20);
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  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 face=Arial color=#0000ff 
    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 face=Arial color=#0000ff 
    size=2>crLinearCorrelation (bars)
     
    <FONT face=Arial color=#0000ff 
    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. 







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.