Regression trees for predicting trade success

Intuitively, why are the following 4 variables useful predicting?

var AutoCorrel = Correlation(Price,Price+1,30);
var Volatility = ATR(30)/ATR(1000);
var DomPeriod = DominantPeriod(100);
var FD = FractalDimension(Price,30);


Quote from jcl:

Thanks for the link! I also tried first to use a tree for generating trade signals, but this didn't work very well. The trees became too complicated and could not be effectively pruned.

CART is indeed not suited in cases where the result can be expressed as a function of products of input variables. I think for this and other reasons, using a decision tree for generating trade signals won't work. However the tree method seems to work quite good as a trade filter. Dependent on input variables the trees look quite simple and have an effectivity in the 70%..90% range.

I'm just testing it with some simple algos. This is the original trade algo with the lowpass filter that I posted in the other thread:

Code:
var *Price = series(price());
var *Trend = series(LowPass(Price,1000));
Stop = ATR(100);

if(valley(Trend)) {
	sellShort();
	buyLong();
} else if(peak(Trend)) {
	sellLong();
	buyShort();
}

And this is the version with the CART filter:

Code:
var *Price = series(price());
var *Trend = series(LowPass(Price,1000));
Stop = ATR(100);
	
var AutoCorrel = Correlation(Price,Price+1,30);
var Volatility = ATR(30)/ATR(1000);
var DomPeriod = DominantPeriod(100);
var FD = FractalDimension(Price,30);
	
if(valley(Trend)) {
	sellShort();
	if(adviseLong(0,Volatility,DomPeriod,AutoCorrel,FD) > 0)
		buyLong();
} else if(peak(Trend)) {
	sellLong();
	if(adviseShort(0,Volatility,DomPeriod,AutoCorrel,FD) > 0)
		buyShort();
}

So I'm using some random indicators, such as fractal dimension, dominant cycle and so on, for input to the tree. The generated rul looks like this:

Code:
int adviseEURUSD_S(var* signal)
{
  if(signal[1] <= 12.938) {
    if(signal[3] <= 0.953) return -70;
    else {
      if(signal[2] <= 43) return 25;
      else {
        if(signal[3] <= 0.962) return -67;
        else return 15;
      }
    }
  }
  else {
    if(signal[3] <= 0.732) return -71;
    else {
      if(signal[1] > 30.61) return 27;
      else {
        if(signal[1] <= 19.315) return 8;
        else {
          if(signal[2] > 46) return -80;
          else {
            if(signal[0] <= -9.606) return -63;
            else return 62;
          }
        }
      }
    }
  }
}

This is for EUR/USD short trades, for other currencies and long trades there are similar rules. The rules are generated by the optimizer and executed in trade and test mode. This is the implementation:

http://zorro-trader.com/en/advisor.htm

The original algo got about 75% annual profit, the version with the "advise" function got 163% profit on unseen data, although the input variables above are more or less random. I plan to test this with more algos and different input variables in the next time.
 
They are not. They were just used for testing if the CART works at all. Only two of them had some predictive value for that strategy, that's why the profit was improved.

The CART inputs used in the last example were the fractal dimension, plus ATRs of 2 different time periods.
 
Quote from jcl:

They are not. They were just used for testing if the CART works at all. Only two of them had some predictive value for that strategy, that's why the profit was improved.

The CART inputs used in the last example were the fractal dimension, plus ATRs of 2 different time periods.

Intuitively, why do they have predictive power and can be helpful here?
 
This is hard to tell. You can see that an input has predictive value when it affects high-weight branches in the CART tree. That means that a certain range of this input, or input combination, is significantly linked to success or failure of the subsequent trade. But I can't say with certainty why a particular input is predictive for a certain strategy, and not for another strategy.

In this case, the predictive inputs had to do with volatility. This indicates probably that the lowpass filter gave false signals in situations outside the normal volatility range. At least that's the theory that comes to mind.
 
Quote from jcl:

This is hard to tell. You can see that an input has predictive value when it affects high-weight branches in the CART tree. That means that a certain range of this input, or input combination, is significantly linked to success or failure of the subsequent trade. But I can't say with certainty why a particular input is predictive for a certain strategy, and not for another strategy.

In this case, the predictive inputs had to do with volatility. This indicates probably that the lowpass filter gave false signals in situations outside the normal volatility range. At least that's the theory that comes to mind.

Then have you tried volatility directly?
 
Quote from jcl:

The results look quite promising so far - the profit almost doubles when I filter out trades with rules generated by a relatively simple regression tree.

  • How good is the prediction fit out of sample? I've tried some random forest modeling and the r-squared is around 2% which isn't that great. Maybe for my particular data it's not a good algorithm to apply.
  • If concentrating solely on volatility, options (implied volatility) are something to look at.
 
Quote from mizhael:

Then have you tried volatility directly?
Yes. A simple volatility threshold indeed also improved the strategy, but less than the CART with the combination of inputs. Nevertheless, you can certainly get the same result as the CART with conventional methods, thresholds and optimizing, it just takes more experimenting and longer time.

Quote from Stoxtrader:

  • How good is the prediction fit out of sample? I've tried some random forest modeling and the r-squared is around 2% which isn't that great. Maybe for my particular data it's not a good algorithm to apply.
The prediction fit of the example varies between 70% and 89% in the different WFO cycles. It heavily depends on the selection of the inputs.

I have not tried a random forest yet. My feeling is that it will probably generate a better fit, but it will make the strategy a black box where you don't see how it works. The single CART has the advantage that you can see the result in code, and it's simple enough for checking if it makes sense.
 
Quote from jcl:

Yes. A simple volatility threshold indeed also improved the strategy, but less than the CART with the combination of inputs. Nevertheless, you can certainly get the same result as the CART with conventional methods, thresholds and optimizing, it just takes more experimenting and longer time.


The prediction fit of the example varies between 70% and 89% in the different WFO cycles. It heavily depends on the selection of the inputs.

I have not tried a random forest yet. My feeling is that it will probably generate a better fit, but it will make the strategy a black box where you don't see how it works. The single CART has the advantage that you can see the result in code, and it's simple enough for checking if it makes sense.

If you've got all these profitable systems, are you running any of them live now?
 
Yes. I'm meanwhile running about 20 systems on live accounts. But they are all conventional systems, I'm not yet live with a CART or perceptron system.
 
Quote from jcl:

Yes. I'm meanwhile running about 20 systems on live accounts. But they are all conventional systems, I'm not yet live with a CART or perceptron system.

How are those 20 systems running live? Do they show similar performance as your back tests?
 
Back
Top