LastValue() does actually return an array... that as progster correctly says is filled with the last value of "SourceArray"... however, AFL knows this and treats it as a number... i.e. it can be passed to an If() statement...
Again, progster is right, LastValue() can look into the future from a backtesting perspective... because it by definition uses the 'lastvalue' of SourceArray. However, this is not an issue if you are using LastValue() on the RHS of the chart in the correct context. --- In [email protected], "progster01" <progs...@...> wrote: > > Consider this: > > Result = LastValue( SourceArray ) ; > > Result is an array, all of the values in which are identical and equal to the > single final value of SourceArray. > > Hence, at all locations in Result, there is a value that represents the "far > in the future" last value of SourceArray. > > Remember, your arrays are each constructed beginning to end at their point of > definition in your AFL. An array defined earlier in your code is completely > constructed before arrays defined later in your code even exist yet. > > In case you are thinking that all arrays are constructed in parallel on a > bar-by-bar basis, they are not. > > > --- In [email protected], Rick Osborn <ricko@> wrote: > > > > Caveat: since this function fills an entire data array with the > > last value of another array, it allows a formula to look into the future. > > so if there are repeated events (buy signals and sell signals), I'm not > > sure if lastvalue sees any but the last one. Plus I worry about the > > Caveat!! >
