Login
Login

Re: Implementing indicators which require OHLC

Home 21090308 Forums Re: Implementing indicators which require OHLC

#2025
Ryu
Member

I do not understand exactly what you are after but I suggest you take a look at this class.
[tt:3sj0dvr1]com.numericalmethod.algoquant.chart.OhlcChartDemo[/tt:3sj0dvr1]

Briefly, the class [tt:3sj0dvr1]OhlcBars[/tt:3sj0dvr1] generates and keeps the OHLD bars for you as you send it prices. For instance, when you create an instance of [tt:3sj0dvr1]OhlcBars[/tt:3sj0dvr1] with DAILY frequency, when you send it a new price with a new time stamp, it will look at the time stamp. If the time stamp belongs to an already created bar of the same day, it will update that OHLC bar for that day. Otherwise a new OHLC bar for a new day is created. All this is done automatically inside [tt:3sj0dvr1]OhlcBars[/tt:3sj0dvr1].

Then your strategy can simply work with [tt:3sj0dvr1]OhlcBars[/tt:3sj0dvr1] to generate any trading signal you like.

Hope this helps.