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

Re: [amibroker] Printing



PureBytes Links

Trading Reference Links


Hi,
 
first of all: larger programmes require many variables and arrays. For this reason, they alsoneed a large name space! To put it succinctly: The best way is to code local variables & arrays instead of global ones. This helps to circumvent eating snicker bars during long debugging sessions at night... 
 
Cheers,
 
Udo
Tomasz Janeczko <amibroker@xxxxxx> wrote:
Hello,You can do this and yes it can be declared as global in each functionwith no problem. The only thing you should take care is not to confuse yourself byusing the same variable names for many different things.Best regards,Tomasz Janeczkoamibroker.com----- Original Message ----- From: "Michael.S.G." To: Sent: Monday, February 02, 2004 2:09 PMSubject: Re: [amibroker] returning more than one array from a function> Tomasz,> What if I am using the same global in Multiple function calls?> Should they be declared global in each function? (This seems strange).> > And what sort of problems can be expected from declaring globals before the > function call?> ie.> > GLOBAL ResultArrayOne , ResultArrayTwo ,
 ResultArrayThree;> Procedure SetTwoArrays()> {> ResultArrayOne = C;> ResultArrayTwo = ROC(C, 1);> }> Procedure ModResultOne()> {> ResultArrayThree = MA(ResultArrayOne,5);> }> SetTwoArrays();> WriteVal( ResultArrayOne);> WriteVal( ResultArrayTwo);> ModResultOne();> WriteVal(ResultArrayThree);> > > > > > > > > At 05:31 AM 2/02/2004, you wrote:> >Dave,> >> >Yes but you should use global keyword inside function to make sure> >it is treates variables as global and you don't need to declare them > >before function call:> >> >function SetTwoArrays()> >{> > global staReturn1, staReturn2;> >> > staReturn1 = C;> > staReturn2 = ROC( C, -1 );> >> > return MACD(); // you can return 3rd array>
 >}> >> >> >SetTwoArrays();> >> >//staReturn1 and staReturn2 variables are accessible there;> >> >WriteVal( staReturn1);> >WriteVal( staReturn2 );> >> >Hope this helps.> >> >Best regards,> >Tomasz Janeczko> >amibroker.com> >----- Original Message -----> >From: "Dave Merrill" > >To: "AmiBroker list" > >Sent: Sunday, February 01, 2004 6:56 PM> >Subject: [amibroker] returning more than one array from a function> >> >> > > Say I have a function that I'd like to have return two arrays. As far as I> > > know, there's no direct way to do that, but I'd like to confirm this for> > > certain, since it would be very handy, and allow better coding practices.> > >> > > The
 closest we can come I think is to set some variables outside the> > > function, before calling it, so they're global, and have the function set> > > them. What I don't like about this is that in contrast to some other> > > languages, the names of those variables have to be hard coded inside the> > > function. I'd much rather pass the names of the result arrays to use (or> > > pointers to them) into the function.> > >> > > For example:> > >> > > ResultArrayOne = ResultArrayTwo = Null;> > > function SetTwoArrays() {> > > ResultArrayOne = C;> > > ResultArrayTwo = ROC(C, 1);> > > }> > >> > > You have to use the variables named ResultArrayOne and ResultArrayTwo for> > > this function to work correctly; those variables are what it sets, no > > matter> > >
 what.> > >> > > Do I have it right that this is the only way to get more than one array > > back> > > from a function?> > >> > > Dave Merrill> > >> > >> > > 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> > >> > >> > > Yahoo! Groups Links> > >> > > To visit your group on the web, go to:> > > http://groups.yahoo.com/group/amibroker/> >
 >> > > To unsubscribe from this group, send an email to:> > > amibroker-unsubscribe@xxxxxxxxxxxxxxx> > >> > > Your use of Yahoo! Groups is subject to:> > > http://docs.yahoo.com/info/terms/> > >> > >> > >> >> >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> >> >> >Yahoo! Groups Links> >> >To visit your group on the web, go to:> > http://groups.yahoo.com/group/amibroker/> >>
 >To unsubscribe from this group, send an email to:> > amibroker-unsubscribe@xxxxxxxxxxxxxxx> >> >Your use of Yahoo! Groups is subject to:> > http://docs.yahoo.com/info/terms/> > > > 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 > > > Yahoo! Groups Links> > To visit your group on the web, go to:> http://groups.yahoo.com/group/amibroker/> > To unsubscribe from this group, send an email to:> amibroker-unsubscribe@xxxxxxxxxxxxxxx> > Your use of Yahoo! Groups is subject
 to:> 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: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html ------------------------ Yahoo! Groups Sponsor ---------------------~-->Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or LexmarkPrinter at MyInks.com. Free s/h on orders $50 or more to the US & Canada.http://www.c1tracking.com/l.asp?cid=5511http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM---------------------------------------------------------------------~->Yahoo! Groups LinksTo visit your group on the web, go
 to:http://groups.yahoo.com/group/amibroker/To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxxYour use of Yahoo! Groups is subject to:http://docs.yahoo.com/info/terms/ 
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!


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








Yahoo! Groups Sponsor


  ADVERTISEMENT











Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.