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

RE: [amibroker] Re: Function Question (for nand)



PureBytes Links

Trading Reference Links




As 
someone else suggested, the Beta Readme gives an excellent example.   
Using the function in your email, it would look something like 
this:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2> 
k 
= 0;   // this is only to make "k" global by defining it 
before using it in the function
<FONT face=Arial color=#0000ff 
size=2>..
<FONT face=Arial color=#0000ff 
size=2>function myFunction (a,b,c) {
<FONT face=Arial color=#0000ff 
size=2>..
<FONT face=Arial color=#0000ff 
size=2>   k = open + low;   // or 
whatever
<FONT face=Arial color=#0000ff 
size=2>   m = close - open;  // or 
whatever
<FONT face=Arial color=#0000ff 
size=2>   return m;
<FONT face=Arial color=#0000ff 
size=2>}
 
p = 
myFunction(1,2,3);
 
// at 
this point, "p" = value returned by function
// and 
k = open + low (or whatever it was set to in the function
<FONT face=Arial color=#0000ff 
size=2>// hence, your function has returned one value and set another 
(global) one
 
 
have 
fun!! 
<BLOCKQUOTE 
>
  <FONT face="Times New Roman" 
  size=2>-----Original Message-----From: Anthony Faragasso 
  [mailto:ajf1111@xxxxxxxx]Sent: Wednesday, May 21, 2003 9:32 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
  Re: Function Question (for nand)Chuck,Could 
  you give a short example ?-------Original 
  Message-------From: amibroker@xxxxxxxxxxxxxxxDate: Wednesday, May 
  21, 2003 9:26:49 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
  [amibroker] Re: Function Question (for nand)The function can only 
  return one value.  However, you can set globalvariables in the 
  function and reference them outside the function.-----Original 
  Message-----From: nkis22 [mailto:nkishor@xxxxxxxxxx]Sent: Wednesday, 
  May 21, 2003 9:17 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
  Re: Function QuestionI know about global and local 
  definitions.What I don't know is how to say it on thereturn 
  line.the fnction calculates j and k.return j ; // returns 
  jreturn k ; // returns kI want to return both j and k 
  return j, k; //doesn't worknand--- In 
  amibroker@xxxxxxxxxxxxxxx, "Herman vandenBergen" <psytek@xxxx> 
  wrote:> You can use Global variables (declared outside the 
  function) and define them> inside the function, to return as many 
  variables as you like. Look up Global> and Local variables in the 
  readme.> > herman> > -----Original 
  Message-----> From: nkis22 [mailto:nkishor@xxxx]> Sent: May 22, 
  2003 7:23 AM> To: amibroker@xxxxxxxxxxxxxxx> Subject: 
  [amibroker] Function Question> > > Can a function return 
  more than one value?> > return j;> > Can I return 
  j and well as k?> How to code it, if possible?> > return 
  j, k; doesn't work.> > nand> > > > 
  > Send BUG REPORTS to bugs@xxxx> Send SUGGESTIONS to 
  suggest@xxxx> -----------------------------------------> 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 <A 
  href="">http://docs.yahoo.com/info/terms/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/groupfaqhtml 
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
  Yahoo! Groups SponsorADVERTISEMENTSend 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/groupfaqhtml 
  Your use of Yahoo! Groups is subject to the 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


  ADVERTISEMENT 









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.