Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If you have a bunch of different econometric data (e.g. indexes, FX, commodities, interest rates...) you can try to find a formula to see if there is any relationship in the data - e.g. to forecast it by this discovered pattern.

What I am asking here is a little bit different: Is there another way in the sense that you can search for a formula f() such that the given form represents a trading strategy where certain indicators are found when to go long or short (or any derivative combinations)? The idea is that the formula itself lives in n-dimensional space of indicators/ trading-strategies and tries to survive as best as it can.

This must be a standard procedure for multi-agent systems simulating artificial stock markets. Alas, I am unable to find a simple approach to do just that...

share|improve this question
up vote 9 down vote accepted

Yes, you use an implementation of each signal and then use a statistical package like sas to generate a factor model for you. It generates a mathematical formula, with coefficients, and signals(variables) and even tells you the efficacy(R^2)

However you quickly find yourself exposed to data snooping bias by choosing this approach. Similar to the results outlined in this paper: http://www.eco.sdu.edu.cn/jrtzx/uploadfile/pdf/empiricalfinance/10.pdf

Data-snooping bias, is why people stress the economic reasoning for their strategies over the historic statistical efficacy, which often fails to replicate going forward.

share|improve this answer
Thank you. Could you please give an example for a trading rule (e.g. moving average) and its mathematical encoding. – vonjd Mar 2 '11 at 12:27
make a function like this: MA(int numdaysavg){return sum(x[i] thru x[i-numdaysavg] / numdaysavg} then use the results of this function over time, [a time series] along with a time series of returns or prices... (this wouldn't be much of a factor model because you only have one factor (moving avg). You can add as many as you like from there. – glyphard Mar 2 '11 at 13:46

Maybe I completely misunderstood the question, but it seems to me that you are looking to find a model structure as opposed to fit a specified/known model. In your context the model specification (the trading rules) are unknown... Am I right?

If that Is the case, maybe genetic programming:


Is what you need?

In a nutshell, it is a sub-class of GA which applies evolutionary approach for finding a model structure (a program) which is most fit... Throughout generations of evolutionary improvements.

My guess is that a language dictionary in this case is a set of constructs (variables) you have at your disposal, and the language grammar are the rules...

Just a thought!

Btw. Good Question!

share|improve this answer
@user40: Thank you, in fact this was my original reference. Could you give me some ideas or references how to encode trading rules within the alphabet of GP? – vonjd Mar 8 '11 at 19:48

Here is an example of the 75% trading rule coded in R: Can one beat the random walk

This is how the author describes the rule:

The following script will generate a random series of data and follow the so called 75% rule which says, Pr[Price>Price(n-1) & Pr<(n-1) < Price_median] Or [Price < Price(n-1) & Price(n-1) > Price_median] = 75%.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.