[Haskell-cafe] need help making sense of the relative indexing

Daryoush Mehrtash dmehrtash at gmail.com
Tue Oct 21 00:22:42 EDT 2008

I am trying to make sense of the relative indexing example used in this
"Charting Patterns on Price history" paper:


In Section 3 it defines:

type Indicator a = Bar → (Maybe a )

Indicator takes a bar b and returns an indicator value for
that bar. .....bar is associated with five basic fields:
high, low, open, close price, and transaction volume


It is very common while defining indicators to use past
values of an indicator. To support this, we have a combina-
tor (♯) which enables relative indexing into past data. Given
a bar (time), while an indicator, say high , evaluates to the
high price at the bar, high ♯ n yields the high price of n th
previous bar. (♯) is defined as follows:

(♯) :: Indicator a → Integer → Indicator a
ind ♯ n = λ b . ind (b − n )

I can't figure out how (b-n) translates to n'th previous bar.  Any ideas?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081020/4f761fd7/attachment-0001.htm

More information about the Haskell-Cafe mailing list