Using Genetic Programming to Search for Trading Expressions
Summary
The document frames the search for stock portfolio signals as an optimization problem. An expression combines market or fundamental variables with unary and binary operators and parameter choices; evaluating it across stocks produces weights, which are normalized into long, short, or zero positions. Historical backtests provide a performance measure such as Sharpe ratio or return to optimize.
The answer points to genetic programming as a way to evolve candidate programs toward a chosen objective, avoiding exhaustive enumeration of every possible expression. It cites research applying single- and multiple-tree genetic programming to dynamic decision making. The document offers this as a direction to investigate, not a tested recipe: it gives no implementation details, empirical results, safeguards against overfitting, or method for using human-labeled successful and failed expressions as training data.
Key ideas
- Trading expressions can combine market data, operators, and parameter choices to generate cross-sectional portfolio weights.
- A backtest can supply the performance objective used to rank candidate expressions.
- Genetic programming evolves programs toward a target measure and can search expression spaces without exhaustive enumeration.
- The cited application connects genetic programming with dynamic decision making, but the document does not report results for the proposed stock strategy.
Tags
Full text
# Answer by Enrico Schumann (score 1, accepted) # Choosing best expressions from all possible combinations on variables, unary operators and binary operators along with hyper parameters I have a few financial variables of a stock universe like OHLC prices, volume, and other fundamentals with varying time-frequency. Using this set I'm creating an expression that gives the weights to be invested in that particular stock among the whole universe for a particular day. For example, an expression can be something like $$(close-open)/vwap$$ $$(close-average(close,10))/std(close,10)$$ The expression is evaluated on each stock of the universe and the final vector is normalized to arrive at the weights to be assigned for that particular stock. If the weight is positive, it means we are going long on that stock and if it is negative the direction is short and if the weight is 0, then no position is assigned for that particular stock. This setting is repeated on past data and backtested to evaluate the performance of expression. Backtest reveals some parameters like Sharpe or absolute return etc. Now given a fixed set of variables, operators, and functions that have some meta parameters, what is the best possible algorithm to find optimal expressions that result in good performance over the historic data(let us say all possible combinations which have a sharpe ratio above 4). Also, it would great to know if there are any algorithms in the literature instead of searching over the whole space of expressions, which can be used to artificially generate new expressions based on a training set created by humans which contains the sequence they used to arrive at a good expressions and expressions which didn't work (artificially generating new expressions). ## Answer by Enrico Schumann (score 1, accepted) https://quant.stackexchange.com/a/49095 The problem you describe can be handled as an optimization problem: evolve a program such that it maximizes some performance measure. The technique you may want to look into is called "Genetic Programming". For a financial application see for example Single versus Multiple Tree Genetic Programming for Dynamic Decision Making.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.