lib/TradeItem.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 TRADEITEM_HPP
00023 #define TRADEITEM_HPP
00024 
00025 #include "BarData.h"
00026 #include "FuturesData.h"
00027 #include <qstring.h>
00028 #include <qdatetime.h>
00029 
00030 
00031 class TradeItem
00032 {
00033   public:
00034 
00035     enum TradeSignal
00036     {
00037       None,
00038       EnterLong,
00039       ExitLong,
00040       EnterShort,
00041       ExitShort,
00042       MaximumLoss,
00043       Profit,
00044       Trailing,
00045       CUSStop,
00046       EndTest
00047     };
00048 
00049     enum TradePosition
00050     {
00051       Long,
00052       Short
00053     };
00054 
00055     TradeItem ();
00056     ~TradeItem ();
00057     void setTradePosition (TradeItem::TradePosition);
00058     TradeItem::TradePosition getTradePosition ();
00059     void setEnterSignal (TradeItem::TradeSignal);
00060     TradeItem::TradeSignal getEnterSignal ();
00061     void setExitSignal (TradeItem::TradeSignal);
00062     void setExitSignal (QString &);
00063     TradeItem::TradeSignal getExitSignal ();
00064     void setEnterDate (QDateTime &);
00065     void getEnterDate (QDateTime &);
00066     void setExitDate (QDateTime &);
00067     void getExitDate (QDateTime &);
00068     void getEnterDateString (QString &);
00069     void getExitDateString (QString &);
00070     void setEnterPrice (double);
00071     double getEnterPrice ();
00072     void setExitPrice (double);
00073     double getExitPrice ();
00074     void setVolume (int);
00075     int getVolume ();
00076     void setStockFlag (bool);
00077     bool getStockFlag ();
00078     void setFuturesType (QString &);
00079     void calculateProfit ();
00080     void getTradePositionString (QString &);
00081     void getExitSignalString (QString &);
00082     double getProfit ();
00083     double getBalance ();
00084     void setBalance (double);
00085     void setEntryCom (double);
00086     double getEntryCom ();
00087     void setExitCom (double);
00088     double getExitCom ();
00089     void setCommissionType (bool);
00090     bool getCommissionType ();
00091     double getCurrentProfit (double xp);
00092     void setMargin (int);
00093 
00094   protected:
00095     TradePosition tradePosition;
00096     TradeSignal enterSignal;
00097     TradeSignal exitSignal;
00098     QDateTime enterDate;
00099     QDateTime exitDate;
00100     double enterPrice;
00101     double exitPrice;
00102     double profit;
00103     double balance;
00104     int volume;
00105     bool stockFlag;
00106     QString futuresType;
00107     bool commissionType;
00108     double entryCom;
00109     double exitCom;
00110     int margin;
00111     FuturesData fd;
00112 };
00113 
00114 #endif