I've been bumping many times over such small inconsistencies in the manual (and still do).
As another example, the description of SetPositionSize states "This function allows to control trade (position) size in four different ways, depending on 'method' parameter.", while the description of sig.PosSize states "requested position size (positive numbers mean dollar value, negative values mean percent of portfolio equity)" As an AB newbie (with limited knowledge how AB internally works), it took me an "eternity" to find out that all of the four different ways of SetPositionSize apply to sig.PosSize as well. --- In [email protected], "Mike" <sfclimb...@...> wrote: > > I agree. I never noticed that page in the guide before. Description of the > parameters at the point of the actual function descriptor would be far more > discoverable. > > Mike > > --- In [email protected], "rise_t575" <rise_t@> wrote: > > > > > > > > Hello, > > > > A short definition within each page of the AFL Function Reference/AB manual > > what type of parameter (scalar/array) is expected/allowed for the > > corresponding function would be a better place for this old known fact. > > That's where most people look at in such cases. > > > > --- In [email protected], Tomasz Janeczko <groups@> wrote: > > > > > > Hello, > > > > > > It is old, known fact. Some functions accept variable periods. Documented > > > in the manual: > > > > > > http://www.amibroker.com/guide/a_varperiods.html > > > > > > > > > Best regards, > > > Tomasz Janeczko > > > amibroker.com > > > > > > On 2010-07-15 08:12, Mike wrote: > > > > Interesting. I ran a quick test and it seems to suggest that Sum does > > > > in fact take an array as second argument, contrary to expectations. > > > > > > > > It would appear that you are correct, with respect to Sum. Though it is > > > > not always the case that a function with a "periods" argument will > > > > accept an array. For those that don't, you will have to find another > > > > approach. > > > > > > > > Here's my test: > > > > > > > > Test = Sum(1, Cum(1)); > > > > Fixed = Sum(1, 5); > > > > > > > > Plot(Test, "Test", colorRed, styleLine); > > > > Plot(Fixed, "Fixed", colorBlue, styleLine); > > > > Title = "Bar: " + BarIndex() + ", Test: " + Test + ", Fixed: " + Fixed; > > > > > > > > If Sum did not accept an array, but was instead substituting some fixed > > > > number (e.g. last element of the array), then both Plots should result > > > > in flat lines. However, the test clearly shows that the Test plot rises > > > > at a 45 degree angle indicating that the period is different at each > > > > bar. Compare that to the Fixed plot which is constant at a level of 5. > > > > > > > > Mike > > > > > > > > --- In [email protected], "aaryan111"<aaryan111@> wrote: > > > >> I guess, sum() is behaving the ideal way :), > > > >> > > > >> The most important thing here is, > > > >> AMIBROKER being an array processing language, calculates all the > > > >> elements of array , but at any given active bar, it fetches the > > > >> current value from the whole arry index and shows it to us,Presumably > > > >> using some barindex kind of mechanism internally. > > > >> > > > >> When we put close, open or any array in any afl , like ((close + open > > > >> + High + Low )/4= MAVG),amibroker produces output based on the > > > >> current value of that array, we dont need to specify current index of > > > >> that array (scalar value) to get output at any current bar,it manages > > > >> it intenally. > > > >> > > > >> Here its impotant to not that, its IRRELEVANT if we use array in a > > > >> Function or simply put it in any statement in afl, it fetches a scalar > > > >> value out of that produced array to show it to us. > > > >> > > > >> when I put SUm(close,Barssince()) It ideally fetches the current > > > >> element of BarsSince array and place it over ther. > > > >> > > > >> This is the ideal way. Sum() is behaving the IDEAL way. > > > >> infact every other function, > > > >> let it be , > > > >> MA(Close,BarsSince(TimeNum()< 093000)); > > > >> or any other function, having Periods, as a second argument. > > > >> > > > >> While in Stdev(),it simply goes against the normal behaviour. > > > >> it should infact, in MUST , point to the current active element of the > > > >> Barssince(), let it be a 0 or any other value, its irrelevant, its > > > >> still a scalar. > > > >> and it simply doesnt do that!. > > > >> > > > >> i think i have made my point clear now. > > > >> > > > >> Wave : Lastvalue() will surely fetch the last element of the array, > > > >> but i cant use it while testing it offline, i will get all future > > > >> values of that array, its all fine if i have to use it while online > > > >> updation. > > > >> > > > >> > > > >> > > > >> Regards... > > > >> > > > >> > > > >> --- In [email protected], "wavemechanic"<olesmithy@> wrote: > > > >>> I'm fairly sure that the only way you will get StDev() to accept > > > >>> BarsSince() in the 2nd argument without complaining is to force the > > > >>> return of a number by use of LastValue() or SelectedValue(). I don't > > > >>> know why Sum() is not complaining when BarsSince() is used. > > > >>> > > > >>> In the Sum() case, I think that BarsSince( TimeNum ... ) is returning > > > >>> a constant array based on the bar you select, including the last bar > > > >>> if no bar is selected. If so, that would work OK but does not > > > >>> explain why StDev() does not work. > > > >>> > > > >>> For Sum(), if you replace TimeNum() with another array generator, for > > > >>> example, MA( C, 13 ) == ...., Sum() still does not complain but > > > >>> BarsSince() returns 0 (I believe) and, hence, Sum() is 0. > > > >>> > > > >>> You might have stumbled onto a unique situation but I would not > > > >>> assume that it can be generalized and would always go for ensuring > > > >>> the return of a number from the 2nd argument whether or not the above > > > >>> is correct. > > > >>> > > > >>> Bill > > > >>> ----- Original Message ----- > > > >>> From: aaryan111 > > > >>> To: [email protected] > > > >>> Sent: July 14, 2010 3:08 PM > > > >>> Subject: [amibroker] Re: Sum and Stdev , wierd behaviour of stdev > > > >>> > > > >>> > > > >>> Hi , thanx for the feedback wave. > > > >>> its Syntax is basically to put Period as 2nd argument. > > > >>> When u put an array in SUM() as 2nd argument, it will take the > > > >>> corresponding scalar frm that array and apply it as a filter. > > > >>> > > > >>> i have successfully executed this > > > >>> > > > >>> Sum(Close,BarsSince(TimeNum()>092400)); > > > >>> > > > >>> regards > > > >>> > > > >>> > > > >>> --- In [email protected], "wavemechanic"<olesmithy@> > > > >>> wrote: > > > >>> > > > > >>> > Neither takes array as 2nd. See syntax in Users Guide. > > > >>> > ----- Original Message ----- > > > >>> > From: aaryan111 > > > >>> > To: [email protected] > > > >>> > Sent: July 12, 2010 3:41 PM > > > >>> > Subject: [amibroker] Sum and Stdev , wierd behaviour of stdev > > > >>> > > > > >>> > > > > >>> > Hi Everybody, > > > >>> > > > > >>> > Both Sum() and Stdev() Functions Have same Arguments > > > >>> Structure.but when i put > > > >>> > Sum(Close,BarsSince(TimeNum()>092400)) > > > >>> > it executes successfully,while > > > >>> > Stdev(Close,BarsSince(TimeNum()>092400)) > > > >>> > gives a warning " Function Expects Different type of argument > > > >>> here " . > > > >>> > > > > >>> > as far as i understand , both can take array as 2nd argument > > > >>> and amibroker will automatically fetch the current running index > > > >>> value of that array as the 2nd argument, same as it does with other > > > >>> functions. > > > >>> > > > > >>> > one can put any other function returning array like > > > >>> barindex() in 2nd argument , result will be same. > > > >>> > > > > >>> > Any suggestions?? > > > >>> > > > > >>> > Regards, > > > >>> > > > > >>> > > > > >>> > > > > >>> > ------------------------------------ > > > >>> > > > > >>> > **** 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 > > > > > > > > > > > > > > > > > > > > > >
