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

Re: [amibroker] procedures: passing parameters



PureBytes Links

Trading Reference Links

Hello,

Arguments in AFL are always passed by value not by reference,
therefore they are not modified outside function scope.

However you may explicitely declare variables as global
inside function and then they will be modified globally.

procedure Test( param1 )
{
  global BuyPrice;

  BuyPrice = param1;
}

BuyPrice = C;

Test( Open );

// now buyprice will have open price assigned


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "ed2000nl" <pablito@xxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, October 06, 2003 1:23 PM
Subject: [amibroker] procedures: passing parameters


> hi,
> 
> I hope this is not already explained elsewhere, couldn't find it 
> anyway.
> 
> I wrote some selling rules which I like to place in a "Procedure" 
> rather than a "Function" because the return is both the "Sell" array 
> and the "SellPrice" array.
> 
> In an other language I worked with (IDL) I could pass variables just 
> by setting them as a parameter and if changed inside the procedure 
> they would come back to me changed as well.
> 
> So in my case the procedure has the following parameters:
> 
> BuyPrice = Open; SellPrice = BuyPrice; SellPrice = 0;Sell = Buy; Sell 
> = 0;
> SellSystem001_proc
> (Buy,BuyPrice,open,high,low,close,hit,lot,maxdur,Sell,SellPrice);
> 
> Inside the procedure Sell and SellPrice are changed. However I tried 
> it and it seems that the procedure does not "give back" these changed 
> variables.
> 
> Am I right about this and how could I solve this?
> 
> thanks + Rgds, Ed
> 
> 
> 
> 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 http://docs.yahoo.com/info/terms/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/