"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 <dmehrtash@gmail.com>:
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=CC3DEF7277760C535F...
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