need help making sense of the relative indexing

I am trying to make sense of the relative indexing example used in this "Charting Patterns on Price history" paper: http://serv1.ist.psu.edu:8080/viewdoc/download;jsessionid=CC3DEF7277760C535FE3AB7C51A2BE90?doi=10.1.1.21.6892&rep=rep1&type=pdf 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? daryoush

"We represent bars by integers... we have five primitive indicators:
high, low, open, close, and volume"
It looks like they are using a single implicit bar chart as the input
for the program; a "bar' is just an integer reference into that chart;
the only thing you can do with a Bar is pass it to an indicator, and
the interesting bits are hardwired into the primitive indicators
(which they don't supply source for in the paper).
-- ryan
2008/10/20 Daryoush Mehrtash
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?
daryoush
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Daryoush Mehrtash
-
Ryan Ingram