I like to nest them like this. Ron D
mx=Max(rw,Max(Rm28Spm,Max(Rm28Fvg,Max(Rm28Svg,Max(yft25tg, Max(yt25tg,Max(yt25tg,Max(y2t25tg,Max(y1t50tg,Max(yf6w50g,yf7w50g)))))))))); mn=Min(rw,Min(Rm28Spm,Min(Rm28Fvg,Min(Rm28Svg,Min(yft25tg, Min(yt25tg,Min(yt25tg,Min(y2t25tg,Min(y1t50tg,Min(yf6w50g,yf7w50g)))))))))); ________________________________ From: Tomasz Janeczko <[email protected]> To: [email protected] Sent: Thu, January 21, 2010 6:37:37 PM Subject: Re: [amibroker] Re: Easy way of finding MAX or a large list Hello, Simplest, but repeated code: x = Max( arr1, arr2 ); x = Max( x, arr3 ); ....continued to.... x = Max( x, arr15 ); x now holds maximum of arr1... arr15 The same but this time using loop: x = Max( arr1, arr2 ); for( n = 3; n <= 15; n++ ) x = Max( x, VarGet("arr"+n) ); Best regards, Tomasz Janeczko amibroker.com On 2010-01-22 00:02, Rob wrote: > Ok Sorry. > > Yes. I have a series of arrays... about 15 of them simply stored in variable > names. > I effectively want to do an array operation across all 15 to leave me with > one array which will represent the maximum values across the 15 arrays. > > --- In [email protected], Tomasz Janeczko<gro...@...> wrote: > >> Hello, >> >> That is of course **NOT** true when it comes to array variables. >> Array-aware MAX >> >> x = MAX( array1, array2 ); >> >> is orders of magnitude faster than equivalent >> >> for( i = 0; i< BarCount; i++ ) >> if( array1[ i ]> array2[ i ] ) x[ i ] = array1[ i ]; >> else x[ i ] = array2[ i ]; >> >> The original poster question was far too general. He did not mention >> if he uses arrays or not and how he defines "the list" of values. >> >> Best regards, >> Tomasz Janeczko >> amibroker.com >> >> On 2010-01-21 19:50, Dennis Brown wrote: >> >>> For a loop, it is much faster to use an if ( var1> var2 ) { max1 = var1; } >>> The max operator is much slower from my tests. >>> >>> I don't know about configuring it for an array operator. >>> >>> BR, >>> Dennis >>> >>> On Jan 21, 2010, at 12:50 PM, Rob wrote: >>> >>> >>> >>>> I should have added... I'm trying to find the max value of a large list of >>>> variables... >>>> >>>> --- In [email protected], "Rob"<sidhartha70@> wrote: >>>> >>>> >>>>> Is there an easy way in AFL to find the maximum value of a large list...? >>>>> >>>>> Is it a case of a for...next loop or nested Max() statements...? >>>>> >>>>> Many Thanks >>>>> >>>>> >>>>> >>>> >>>> >>>> ------------------------------------ >>>> >>>> **** IMPORTANT PLEASE READ **** >>>> This group is for the discussion between users only. >>>> This is *NOT* technical support channel. >>>> >>>> TO GET TECHNICAL SUPPORT send an e-mail directly to >>>> SUPPORT {at} amibroker.com >>>> >>>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at >>>> http://www.amibroker.com/feedback/ >>>> (submissions sent via other channels won't be considered) >>>> >>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: >>>> http://www.amibroker.com/devlog/ >>>> >>>> Yahoo! Groups Links >>>> >>>> >>>> >>>> >>>> >>> >>> ------------------------------------ >>> >>> **** IMPORTANT PLEASE READ **** >>> This group is for the discussion between users only. >>> This is *NOT* technical support channel. >>> >>> TO GET TECHNICAL SUPPORT send an e-mail directly to >>> SUPPORT {at} amibroker.com >>> >>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at >>> http://www.amibroker.com/feedback/ >>> (submissions sent via other channels won't be considered) >>> >>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: >>> http://www.amibroker.com/devlog/ >>> >>> Yahoo! Groups Links >>> >>> >>> >>> >>> >>> >> > > > > ------------------------------------ > > **** IMPORTANT PLEASE READ **** > This group is for the discussion between users only. > This is *NOT* technical support channel. > > TO GET TECHNICAL SUPPORT send an e-mail directly to > SUPPORT {at} amibroker.com > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > http://www.amibroker.com/feedback/ > (submissions sent via other channels won't be considered) > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > Yahoo! Groups Links > > > > > ------------------------------------ **** IMPORTANT PLEASE READ **** This group is for the discussion between users only. This is *NOT* technical support channel. TO GET TECHNICAL SUPPORT send an e-mail directly to SUPPORT {at} amibroker.com TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at http://www.amibroker.com/feedback/ (submissions sent via other channels won't be considered) For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: http://www.amibroker.com/devlog/ Yahoo! Groups Links
