Financial Strategy Optimization Tool

There are lots of technical indicators such as SMA, RSI, MFI, and MACD that are heavily used in financial markets. People use these indicators to decide when to buy and sell a financial asset. For example, SMA (Simple Moving Average) is calculated as the average of the asset's prices over the last n days. When the short-term SMA is greater than the long-term SMA, it indicates that prices have been rising in recent days, and vice versa. In short, a very simple financial strategy can be described as "buy when the SMA-short is greater than the SMA-long and sell when the opposite occurs". However, what should be the "long" and "short" periods for this strategy?

By using this project, these kind of parameters can be optimized with the genetic algorithm (GA) or particle swarm optimization (PSO) algorithm when strategy is coded in Java.

Note: User interface is developed with Java Swing. Apache POI is used for generating reports as Microsoft Excel files and JFreeChart is used to generate financial charts.

Financial Strategy Optimization Tool

Financial strategy is coded in Part 1 and initialization is coded in Part 2. The parameters to be optimized are listed in Part 3 along with their boundary values. Cases such as assets to be worked on are listed in Part 4.

In Part 5, the financial environment, including factors like budget, transaction is entered. The optimization algorithm and its parameters are entered in Part 6.

The results of each candidate (chromosome for GA, particle for PSO) are listed in Part 7, sorted by their fitness values. The best fitness values of each iteration are listed in Part 8.

Distributed Version

Because it takes too much time for a single computer to optimize parameters, a distributed version was developed. The command-line server application accepts optimization tasks and distributes fitness calculation tasks to the processor nodes. These processor nodes are another command-line Java programs that receive calculation tasks from the server and return fitness values and financial statistics back to the server. Lastly, the server application sends the optimization results to the requester.

Distributed Version