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

[amibroker] Re: procedures: passing parameters



PureBytes Links

Trading Reference Links

thanks, it works. I removed Sell and SellPrice as parameters and 
declared them as global variables inside the procedure and it works 
perfect! 

BuyPrice = Open;
SellSystem001_proc(Buy,BuyPrice,open,high,low,close,hit,lot,maxdur); 

rgds, Ed

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> 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@xxxx>
> 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@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > 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/