lib/IndicatorPlugin.h

Go to the documentation of this file.
00001 /*
00002  *  Qtstalker stock charter
00003  *
00004  *  Copyright (C) 2001-2007 Stefan S. Stratigakos
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019  *  USA.
00020  */
00021 
00022 #ifndef INDICATORPLUGIN_HPP
00023 #define INDICATORPLUGIN_HPP
00024 
00025 #include "PlotLine.h"
00026 #include "Setting.h"
00027 #include "BarData.h"
00028 #include "Indicator.h"
00029 #include <qstring.h>
00030 #include <qstringlist.h>
00031 #include <qdict.h>
00032 #include <qvaluelist.h>
00033 #include <qobject.h>
00034 
00035 class IndicatorPlugin : public QObject
00036 {
00037   Q_OBJECT
00038 
00039   signals:
00040     void signalWakeup ();
00041   
00042   public:
00043   
00044     enum FormatType
00045     {
00046       FormatInputArray,
00047       FormatInputArray2,
00048       FormatInteger,
00049       FormatDouble,
00050       FormatString,
00051       FormatMAType,
00052       FormatBool
00053     };
00054 
00055     enum Operator
00056     {
00057       Equal,
00058       LessThan,
00059       LessThanEqual,
00060       GreaterThan,
00061       GreaterThanEqual,
00062       And,
00063       Or
00064     };
00065 
00066     IndicatorPlugin();
00067     virtual ~IndicatorPlugin();
00068     void setIndicatorInput (BarData *);
00069     void loadFile (QString &, Setting &);
00070     void saveFile (QString &, Setting &);
00071     void getPluginName (QString &);
00072     void getHelpFile (QString &);
00073     IndicatorPlugin::Operator getOperator (QString &);
00074     PlotLine * getWilderMA (PlotLine *d, int);
00075     void getMATypes (QStringList &);
00076     bool checkFormat (QString &, QPtrList<PlotLine> &, int, int);
00077     void setFormatMethod (QString &);
00078 
00079     virtual Indicator * calculate ();
00080     virtual int indicatorPrefDialog (QWidget *);
00081     virtual PlotLine * calculateCustom (QString &, QPtrList<PlotLine> &);
00082     virtual void getIndicatorSettings (Setting &);
00083     virtual void setIndicatorSettings (Setting &);
00084     virtual void setCustomFunction (QStringList &);
00085     virtual void loadIndicatorSettings (QString &);
00086     virtual void saveIndicatorSettings (QString &);
00087     virtual PlotLine * getMA (PlotLine *d, int, int);
00088     virtual void formatDialog (QStringList &, QString &, QString &);
00089 
00090   public slots:
00091     void wakeup ();
00092     
00093   protected:
00094     BarData *data;
00095     QStringList lineTypes;
00096     QStringList inputTypeList;
00097     QStringList opList;
00098     QStringList maList;
00099     bool saveFlag;
00100     QString pluginName;
00101     QString helpFile;
00102     QValueList<FormatType> formatList;
00103     QStringList formatStringList;
00104     bool dateFlag;
00105     bool logScale;
00106     QString formatMethod;
00107 };
00108 
00109 #endif
00110