In the previous week I asked here if price action really works, and was informed that trading based on price patterns is indeed very profitable. So I'm trying it and these are my first results.
The task is finding price patterns that precede profitable trades. I am not able to look through tons of price charts, and a computer can do this anyway much better, so I'm using a decision tree for identifying profitable price patterns.
The first question is what constitutes a price pattern. A classical pattern is the result of comparing the o l h c prices of 3 bars. But a direct comparison seems not so good to me: when the prices are very close, the result is more or less random. So for the test I use their change ratio from one bar to another, like this:
For this first test, I didn't use high, low, open, and close, but instead the medium price of the bar, and the range of the bar. I figured that this might constitute a more significant pattern, as with intraday bars the open and close prices are just determined by the bar offset, and they are anyway almost identical between bars.
The second question is what constitutes a profitable trade. I just look for three ascending bars with a price difference above a certain threshold:
The "Mode |= PEEK;" is required here because I'm peeking in the future with negative price offsets. Without the PEEK flag, the program would complain.
This is the simple lite-C strategy script that finds the price patterns:
The adviseLong(DTREE,...) function generates the decision tree with a learn result given by findProfit(), and 6 input signals that constitute the price changes and the range changes of the last 3 bars. In the simulation, it returns the result of the decision tree.
When I run the above script, it generates a decision tree that looks like this:
This is only the first part of the tree, it's much longer. The size of the tree already suggests that the price changes and range changes of the last 3 bars have almost no predictive value for a profitable trade. The prediction accuracy is 8%.
Of course, when I run a trade simulation with the above tree, I'm getting 2000% annual return and a Sharpe ratio of 7 - but this is just overfitting. When I use out of sample data, I get 60% loss. This is better than random trading, but that's the only good news. Pruning the tree aggressively improves the results, but I don't exceed 20% annual loss on out of sample data.
So, these first results seem to contradict the statements by many users that price action trading is profitable.
What could I do better here? Maybe using other input signals, really comparing olhc, using a different criterion for a profitable trade, using other assets than EUR/USD, and other time frames than 60 minutes? Has someone suggestions for better tests?
The task is finding price patterns that precede profitable trades. I am not able to look through tons of price charts, and a computer can do this anyway much better, so I'm using a decision tree for identifying profitable price patterns.
The first question is what constitutes a price pattern. A classical pattern is the result of comparing the o l h c prices of 3 bars. But a direct comparison seems not so good to me: when the prices are very close, the result is more or less random. So for the test I use their change ratio from one bar to another, like this:
Code:
var Change(int n)
{
return (price(n)-price(n-1))/price(n-1);
}
For this first test, I didn't use high, low, open, and close, but instead the medium price of the bar, and the range of the bar. I figured that this might constitute a more significant pattern, as with intraday bars the open and close prices are just determined by the bar offset, and they are anyway almost identical between bars.
The second question is what constitutes a profitable trade. I just look for three ascending bars with a price difference above a certain threshold:
Code:
bool findProfit()
{
Mode |= PEEK;
var Rate = (price(-3)-price(0)-Spread)/price(0);
if(Rate < THRESHOLD) return false;
int i;
for(i = 0; i > -3; i--)
if(price(i-1) < price(i))
return false;
return true;
}
The "Mode |= PEEK;" is required here because I'm peeking in the future with negative price offsets. Without the PEEK flag, the program would complain.
This is the simple lite-C strategy script that finds the price patterns:
Code:
function run()
{
TimeExit = 3; // exit trade after 3 bars
if(0 < adviseLong(DTREE,findProfit(),
PriceChange(1),PriceChange(2),PriceChange(3),
RangeChange(1),RangeChange(2),RangeChange(3)))
enterLong();
}
The adviseLong(DTREE,...) function generates the decision tree with a learn result given by findProfit(), and 6 input signals that constitute the price changes and the range changes of the last 3 bars. In the simulation, it returns the result of the decision tree.
When I run the above script, it generates a decision tree that looks like this:
Code:
int EURUSD_L(float* sig)
{
if(sig[2] <= -0.317) {
if(sig[2] <= -0.465) {
if(sig[0] <= -0.028) {
if(sig[2] <= -0.497) { return -1; }
else { return 1; }
}
else {
if(sig[3] <= 1.763) { return -1; }
else { return 1; }
}
}
else {
if(sig[1] > -0.198) { return -1; }
else {
if(sig[1] <= -0.234) { return -1; }
else { return 1; }
}
}
.....
This is only the first part of the tree, it's much longer. The size of the tree already suggests that the price changes and range changes of the last 3 bars have almost no predictive value for a profitable trade. The prediction accuracy is 8%.
Of course, when I run a trade simulation with the above tree, I'm getting 2000% annual return and a Sharpe ratio of 7 - but this is just overfitting. When I use out of sample data, I get 60% loss. This is better than random trading, but that's the only good news. Pruning the tree aggressively improves the results, but I don't exceed 20% annual loss on out of sample data.
So, these first results seem to contradict the statements by many users that price action trading is profitable.
What could I do better here? Maybe using other input signals, really comparing olhc, using a different criterion for a profitable trade, using other assets than EUR/USD, and other time frames than 60 minutes? Has someone suggestions for better tests?
