Finance and Investment Industry
Financial Trading Expert System
Nanyang Technological University. Singapore.
Research and Financial Engineered By: Francis Lim, 2001.
ABSTRACT
The aim of this study is to design and develop a financial trading expert system. The principal function of this trading expert system is to provide traders the discovery mechanism for system trading that will result in improving the trader's psychology and self-confidence.
This study will help to develop a proactive approach to investing, explaining how to develop an accurate forecasting of the stock market outlook. The key principles of effective trading strategies and its trading analysis approaches are reviewed. It reviews on various well-known financial technical indicators, explaining how these indicators tools are used to maximize stock market profits. The study surveys the various related computerized trading expert systems available in today's market where traders and investors can capitalize on the breadth of available financial information data sources and electronic brokerage services.
The concepts and principles involved in trading expert system development are discussed, including data collection and verification, data processing, stock selection, trade strategy, trade simulation and live trading.
The performance evaluations of the trading results are tested out with different market trends and conditions. The performance measures of how good a trading system works are important in evaluating targets and expectations by comparing various alternative strategies in assessing the system risk and reward ratio.
The study concludes with a discussion of the experiences and lessons learnt in developing the system, highlighting the features of a good design trading system and as well the limitations of the study and providing recommendations for further improvement to the system.
Abstract of FETS 'C' Programming Code
/*
* Authors : Francis Lim
* Course : Master of Science in Information Studies
* System : Financial Trading Expert System
* Progamming Language : Metrowerks IDE v 4.0, Macintosh Platform OS 9.1
* Description : Data Flow Diagrams
* FileName : stocks_finmkt_model.cpp
* Created : 01 September 2000
* Last Modified : 31 June 2001
*/
class MovingAverage{
public:
double MA1;
double MA2;
double MA3; };
class MovAvgSpread{
public:
double S1;
double S2;
double S3;};
class TrendMover{
public:
int UpTrend;
int DownTrend;
double Lowest;
double Highest;
double ChgInPrice;
};
class StopLossProfit{
public:
double StopLoss;
double StopProfit;};
class NetworkWeights{
public:
bool MAvgEntry;
bool MAvgExit;
bool UpTrend;
bool DownTrend;
bool StopProfit;
bool StopLoss;
bool EntrySignal;
bool ExitSignal;
bool HoldSignal;
char BuySignal;
char SellSignal;
double BuyPrice;
double SellPrice;
double Profit;};
class NetWorkBuySellSignal{
public:
bool BSSignal;
long BSRec;};
class FinModelndicators{
public:
MovingAverage MAvg;
MovAvgSpread MASpread;
TrendMover TMov;
StopLossProfit SLP;
NetworkWeights NW;
TimeSeriesData Eq;};
class EquitySummaryRpt{
public:
char StockSymbol[32];
char Market[25];
char Sector[25];
long TDFromDate;
long TDToDate;
long ContractSize;
double PLPosition; // Profit and Loss Account
double NetPL;
double GrossProfit;
double GrossLoss;
double PercProfitTD; // Percent Profitable Trade
long TotalTD; // Total Trades Invested
long WinTD; // Number of Winning Trades
long LossTD; // Number of Losing Trades
double LWinTD; // Largest Winning Trade
double LLossTD; // Largest Losing Trade
double AvgWinTD; // Average Winning Trade
double AvgLossTD; // Average Losing Trade
double RAvgWinLossTD; // Ratio Average Winning and Losing Trade
double PercReturnAcc; // Percent Return On Account;
double InitMktCapital; // Initial Market Capital;};
class SimulateEquityTrading{
public:
char StockSymbol[31];
long EqRec, BufferLen;
char DataBuffer[DATABUFFER];
char EqTradeDir[CHRSTR256];
char EqTradeRptDir[CHRSTR256];
char EqSimuFName[CHRSTR256];
char EqFName[CHRSTR256];
EquitySummaryRpt ESR;
FinModelndicators FMI[10000];
NetWorkBuySellSignal NBS;};
SimulateEquityTrading SEQT;
FinModelndicators init_FinModelndicators (FinModelndicators FMI);
double normalize_MovingAverage (int maPeriod, long rec);
double normalize_MA_Spread (int maPeriod, long rec, double maValA, double maValB);
double percentage_Change_In_lastprice (long rec, double prValA, double prValB);
double normalize_HighestHigh (int hiPeriod, long rec);
double normalize_LowestLow (int loPeriod, long rec);
bool moving_Average_UpSignal (int maPeriod, long rec, MovingAverage MAvg);
bool moving_Average_DownSignal (int maPeriod, long rec, MovingAverage MAvg);
bool train_BuySignal (int maPeriod, long rec, int hiPeriod, int tmovUp, bool maEntryState, NetWorkBuySellSignal NBS);
bool train_StopProfitSignal (int maPeriod, long rec, double stopProfitPerc, NetWorkBuySellSignal NBS, TimeSeriesData T1, TimeSeriesData T2);
bool train_StopLossSignal (int maPeriod, long rec, double stopLossPerc, NetWorkBuySellSignal NBS, TimeSeriesData T1, TimeSeriesData T2);
bool train_SellSignal (int maPeriod, long rec, int tmovDown, bool maExitState, NetWorkBuySellSignal NBS);
bool train_HoldSignal (int maPeriod, long rec, TimeSeriesData Eq, TrendMover TMov, NetWorkBuySellSignal NBS);
bool train_HoldSignal_Ext (int maPeriod, long rec, TimeSeriesData Eq, TrendMover TMov1, TrendMover TMov2, NetWorkBuySellSignal NBS);
bool train_HoldSignal_Ext1 (int maPeriod, long rec, TrendMover TMov1, TrendMover TMov2, NetWorkBuySellSignal NBS);
bool train_HoldSignal_Ext2 (int maPeriod, long rec, TimeSeriesData Eq, TrendMover TMov1, TrendMover TMov2, NetWorkBuySellSignal NBS);
NetWorkBuySellSignal rec_Network_EntrySignal (int maPeriod, long rec, double avgPrice, double priceRatio, bool sigEntryState, NetWorkBuySellSignal NBS);
NetWorkBuySellSignal rec_Network_ExitSignal (int maPeriod, long rec, bool sigExitState, NetWorkBuySellSignal NBS);
void write_simu_equity_stats (char *filename);
EquitySummaryRpt init_Equity_Performance_Report (EquitySummaryRpt ESR);
EquitySummaryRpt equity_Performance_Report (char *filename, bool initStatus, EquitySummaryRpt ESR);