Sunday, February 27, 2011

The contest

I've been testing six different type of applied machines, during 15 days, from January to February 2011.

Participants were:
  • LSSVM with polynomial kernel, with parameters (1,1)
  • Simplistic as was described in a previous post
Each participant was using three different sets of data:
  • sequence of earnings got with the indicator AIS, described in a previous post, minute by minute (I named it earn)
  • sequence of Bollinger Bands values: mean, low and upper band and %b (relative amplitude of the bands) (I named it bolli)
  • sequence of high, low, open, close prices, RSI(14,close) and volume minute by minute (I named it rstuvw... don't ask me why)
Combining them, we get six different possibilities. I'm working, as usually, with six forex (EURCHF, USDCHF, USDJPY, GBPJPY, GBPUSD, EURUSD).

Final results were:

LSSVM earn37-35126251070
LSSVM bolli1147170127591
LSSVM rstuvw2-902241891331
Simpl. earn-10-435178941931
Simpl. bolli-1330198-320133-251
Simpl. rstuvw-651623-117386-476

Numbers indicate 1e-4 proportion of revenue (over 1, thus 1 is 100%)
Total final revenue is 2.117 (211'7%).
Proportions are calculated following this formula for long positions (calculus is quite similar for short positions):

There are let three positions at the same time open for each combination and strategy (long and short). Spread is the number of pips for each FX, depending on the platform you use. In my case, using a Hanseatic account, spread pips are for each mentioned FX:
0.0005, 0.0005, 0.0005, 0.0005, 0.0002, 0.0003

Underlying prices used even for training and testing the machines are:
  1. 360 minutes (six hours) from 3AM to 9AM Madrid Time as training data
  2. 24 hours, from the end of training (9AM) to 9AM the following day
In the other side, limitations to LSSVM and Simplistic machines are the same for every one: RSI and Bollinger should recommend the entrance, and RSI and time is used to signal when to close the position. No positions are opened for more than 40 minutes.

To investigate:
  1. 24 hours as training data
  2. Risk and efficient portfolio of machines
  3. Which machines are again and again good for which FX.
That's all, folks.

Friday, February 25, 2011

Maximum profits indicator

Here it is: the Matlab code for "ais" indicator, as I've commented in a previous post.

function [long short] = ais(HLOC, timeframe, pips)
% ais
% [long short] = ais(HLOC, timeframe, pips)
% Indicator of maximum profit for each moment open a position in just
% this moment
% Parameters:
% HLOC, matrix with High,Low,Open,Close prices values in columns.
% timeframe, size of the window to before closing the position
% pips, spread between opening and closing position
% Output:
[p1 p2] = size(HLOC);

long = [];
short = [];
for ii=1:p1-timeframe
% Long positions
profit = -inf;
for jj=ii+1:ii+timeframe
profit2 = (HLOC(jj,1) - HLOC(ii,3)-pips)/HLOC(ii,3);
if profit2 > profit
profit = profit2;
long = [long

% Short positions
profit = -inf;
for jj=ii+1:ii+timeframe
profit2 = (HLOC(jj,3) - HLOC(ii,2)-pips)/HLOC(ii,3);
if profit2 > profit
profit = profit2;
short = [short

Thursday, February 24, 2011

MQ4/Metatrader historical data bug

Only to avoid missing this information:
working with MQ4 and Metatrader platform, I'm having some problems trying to get historical data from several FX at the same time. This bug is affecting my Simplistic and LSSVM machines and moving them to make mistakes.

The bug is the following: when I get open,close,high,low,rsi and volume information for the last ten minutes for six forex, I get information with a minute of delay for one or of the forex.

The problem arises only when the request is executed in the first 30 seconds of the minute.

Requesting the data during the last 30 seconds, there is no problem....

Sunday, February 20, 2011

Stability and unsuitability for simplistic model

The main problem related to simplistic is the "stability" against training variances.

When training set suffers a little change (for instance 10 minutes more or less), the results are unpredictable, incurring into great loses or earnings…. apparently randomness (is chaotic, now I remember!)

I've tried to solve it using a linear LSSVM. With a RBF LSSVM, stupid results are got (everything has the same value per day, depending only on the set of train data… mmmmm….. it would be interesting….). With polynomial kernel, better stability and no loss in precision is got. Ok, let's try with LSSVM and polynomial kernels.

Correlation among profits

We define an indicator:

aispos(t) = max. profit if a long position has been opened at time t-T

aisneg(t) = max. profit if a short position has been opened at time t-T

With this indicator, we try to study correlation and mutual information between different forex.

Considering the forex EURCHF, USDCHF, USDJPY, GBPJPY, GBPUSD, EURUSD numbered from 1 to 6, I'm showing here the graphical results:

What does it mean for me? That it could be frustrating trying to predict when it's a good moment to buy a long position (the same analysis should be done for short positions) for these FX with low correlation and low AMI for every other FX.

Maybe I should explain what AMI is...

Saturday, February 19, 2011

Simplistic explanation

Here I write down what I'm calling "Simplistic": a simplistic machine is intent of generate linear chaotic buy signals. Linear, to be easy and fast to compute, and chaotic to try to recreate market behaviour (oohhh, I would like to say to avoid Platonic market assumptions...).

Ok, let's go to the formulae:

Evaluation of simplistic trying to predict a market short term trend:

If the result is greater than zero, we should buy. If not, we should not. So simple.
In the formula, x is a set of values (prices, indicators...) in the moment t.

Simplistic is trained with positive and negative cases (thus when should buy or when should not). The previous evaluation is made for a training set, maximizing the sum of positive cases restricted to f(x)<0 for negative cases.

I'm very lazy, so I use a stupid Simplex to look for solutions.

What in hell is the x? In my first approach, I use only prices for one Forex (EURCHF) trade.
But, as I'm pretend I'm a trader, and I know that risks must be reduced diversifying investments, and blah blah blah, I'm currently evaluating several values for several FX:
  • High, Low, Open and close prices for each minute
  • Volumes
  • RSI
  • and I'm inverting positions to get a chain (I don't know why, but it looks pretty) : EURCHF > 1/USDCHF > USDJPY > 1/GBPJPY > GBPUSD > 1/EURUSD

My dream is: if I'm able to find when the previous chain is not zero-sum (that is, if a move my money from EUR to EUR going through the chain of changes, I should have to get the same money -ignoring commissions, spreads pips an so), I would be ready to predict that, in a very short future the chain will return to zero-sum status.

The way I'm composing the x vector is:
being h,l,o,c,vol,rsi the values previously described, and T the timeframe for the machine.

As Simplistic is too nervous. Should be limited by RSI and Bollinger Bands controls.
And techniques to abandon a failed position.

Wednesday, February 2, 2011

Simplstic better than LSSVM

Simplistic predictors are better than LSSVM ones.

The first one are earning. The second one thinks that the best option is to be quiet, not investing at all...

Simplistic had a programming error (in MQ4 code): it confuses estrategies working only on short positions.

It has been added a new feature: exiting when RSI is signaling no more profits w
ill be get, but "take profit" condition has not been yet reached.

Another thing more: they work better as far as they are trained frequently, with
recent prices