00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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