wxFreeChart
movingaverage.h
1 // Name: movingavg.h
3 // Purpose: moving average declaration
4 // Author: Moskvichev Andrey V.
5 // Created: 2010/12/17
6 // Copyright: (c) 2010 Moskvichev Andrey V.
7 // Licence: wxWidgets licence
9 
10 #ifndef MOVINGAVERAGE_H_
11 #define MOVINGAVERAGE_H_
12 
13 #include <wx/xy/xydataset.h>
14 #include <wx/ohlc/ohlcdataset.h>
15 
19 class WXDLLIMPEXP_FREECHART MovingAverage : public XYDataset
20 {
21  DECLARE_CLASS(MovingAverage)
22 public:
28  MovingAverage(OHLCDataset *ohlcDataset, int period);
29  virtual ~MovingAverage();
30 
31  virtual size_t GetSerieCount();
32 
33  virtual wxString GetSerieName(size_t serie);
34 
35  virtual size_t GetCount(size_t serie);
36 
37  virtual double GetX(size_t index, size_t serie);
38 
39  virtual double GetY(size_t index, size_t serie);
40 
41  //
42  // DatasetObserver
43  //
44  virtual void DatasetChanged(Dataset *dataset);
45 
46 private:
47  OHLCDataset *m_ohlcDataset;
48  int m_period;
49 };
50 
51 #endif /* MOVINGAVERAGE_H_ */
virtual size_t GetSerieCount()=0
Returns serie count in this dataset.
virtual double GetX(size_t index, size_t serie)=0
Returns x value at index.
virtual double GetY(size_t index, size_t serie)=0
Returns y value at index.
Open-High-Low-Close datasets base class.
Definition: ohlcdataset.h:31
virtual size_t GetCount(size_t serie)=0
Returns value count in serie specified by index.
void DatasetChanged()
Called to indicate, that dataset is changed.
Base class for all datasets (XYDatasets, XYZDatasets, CategoryDatasets, OHLCDatasets, etc).
Definition: dataset.h:39
Base class for XY datasets.
Definition: xydataset.h:21
Simple moving average indicator.
Definition: movingaverage.h:19
virtual wxString GetSerieName(size_t serie)=0
Returns serie name.