## Wednesday, November 9, 2011

### Why High Frequency Trading cannot be backtested

## Saturday, November 5, 2011

### What is Algorithmic Trading

## Thursday, November 3, 2011

### President, Vicepresident, Analyst and so

- Most junior: Analyst (1st year, 2nd year and 3rd year) -Bachelor-
- Associate (1st year, 2nd year, 3rd year) -Masters-
- Vicepresident -Masters and 3 to 6 exp. years-
- Senior Vicepresident or Director -5 to 10 exp. years-
- Most senior: Managing Director -7 to 10 exp. years-
- Head of Department -more than 10 exp. years-

## Tuesday, November 1, 2011

### What is Systematic Trading

*employ*technology to capture profit opportunities.

*discretionary trading*. Compared to systematic trading, discretionary trading has more influence from emotions, no easy possibilities of backtesting and a limited risk control

*algorithmic*trading and

*quantitative*trading. But algorithmic trading is more related to how to trade an order or a set of orders, using a set of well-known algorithms. Quantitative trading includes all those kind of trading (systematic, discretionary, algorithmic, HFT...) which uses too quantitative techniques to decide trading options and executions.

## Monday, October 10, 2011

### Mutual cointegration, single correlation

**Cointegration between two data series**:

*a, ut*such that: xt = a·yt + ut

_{ with u stationary in average and variance. Cointegration tries to capture historical trends and dynamics between two series.}**Single correlation between two data series**:

## Friday, September 30, 2011

### Other systematic trading systems

## Sunday, September 25, 2011

### Architecture for the ideal systematic trading platform

## Thursday, September 22, 2011

### One month designing the ideal systematic trading system

- Forecast daily volume profile, to improve VWAP trading algorithms (no, no, I'm not programming those trading algorithms; they're provided by SunGard platform)
- Create a system to deal with huge volumes of CSV files (tick data, you know) without using a traditional (slow) SQL database
- Calculate proxies to improve hedging, thus "
*remembering that we're working in the sell side, why are we hedging an index with the whole set of instruments in the index if we can do it with other highly correlated and cheaper instruments?*"

## Thursday, May 5, 2011

### QuantLib

## Monday, April 11, 2011

### SVM ready for the race.

- To limit the amount of money, one unit if the previous operation was with profit>0.
- To move the amplitude of Bollinger bands (that are, jointly with RSI, limiting alfa signals) increasing in a factor of 1.5 if the previous operation was failure (with a limit of 5*
*Amplitude*) or decreasing in a factor of 1.5 with a minimum of*Amplitude*/1.5), letting be*Amplitude*the value of initial amplitude Bollinger (decide for each pair of forex). - To avoid operations if training was against trend (this improves slightly returns, but it doesn't turn them into negative even in the worst cases).

## Wednesday, March 16, 2011

### Python and Quant

nov29 = CalUtils.createStrikeDate(29, 11, 2010)

portfolio = Portfolio()

market = Market()

# EURCHF - how many CHF to buy 1 EUR

op1 = EuropeanLongCall(0.01440, 1.3335, nov29, "EURCHF", 20000)

op2 = EuropeanShortCall(0.00220, 1.3615, nov29, "EURCHF", 200000)

# CHFEUR - how many EUR to buy 1 CHF

debt = Loan(nov29, "CHFEUR", 1300)

portfolio.add(op1)

portfolio.add(op2)

portfolio.add(debt)

# Simulation

print "EURCHF", ",", "Payoff", ",", "Loan"

for a in xrange((1.3800 - 1.3280) / 0.0001):

x = a * 0.0001 + 1.3280;

market.setPrice(nov29, "EURCHF", x)

market.setPrice(nov29, "CHFEUR", 1/x)

portfolio.setMarket(market)

print x, ",", portfolio.getProfit(nov29) - portfolio.totalCost(), ",", debt.getProfit(nov29)

## Monday, March 14, 2011

### Black Mondays

They've lost all the past weeks profits, and a little more.

Right! I should to include a "non trade in Monday" condition....

Now the question is "why are they making mistakes?". "Why the market is different in Monday than in Tuesday?"

Maybe human traders are getting their weekly positions. I'm not a trader (this smelly work should be done by machines) so I don't know.

## Wednesday, March 2, 2011

### MQ4, solution to get historical prices

//+------------------------------------------------------------------+

//| collectPrices.mq4 |

//| luisf.canals@.... |

//| |

//+------------------------------------------------------------------+

#property copyright "luisf.canals@..."

#property link ""

#property library

#include "..\include\collectPrices.mqh"

/**

* Gets the matrix of prices for currencies.

*

* Return a Matrix with first line for prices on moment T-K,T-K+1,...T-1.

*

* Each line has: High, Low, Open, Close, Volume and RSI for symbol[0],

* symbol[1],...,symbol[N-1].

*

* 'prices' matrix should have 1 + K x 6*ArraySize(symbols) dimensions,

* the first one for timestamps.

*

* Returns false if prices cannot be get.

*/

bool collectPrices(string symbols[], int K, double &prices[][]) {

int period = PERIOD_M1;

int timebase = ((TimeCurrent()/60) - 1) * 60;

if(timebase<=prices[K-1][0]) return (false);

double line[];

ArrayResize(line, (6*ArraySize(symbols))+1);

for(int i=0; i<ArraySize(line); i++) line[i]=0;

while(true) {

for(int s=0;s<ArraySize(symbols); s++) {

int j=6*s + 1;

Print(symbols[s] + ":" + iTime(symbols[s], period, 1)

+ " - timebase=" + timebase);

if(line[j]==0 && iTime(symbols[s],period,1)>=timebase) {

// Go back in time if iTime>timebase

if(iTime(symbols[s],period,1)<timebase

&& symbols[s]==Symbol()) {

return (false);

}

if(iTime(symbols[s], period, 1)>timebase) {

return (false);

}

int t = 1;

line[j] = iHigh(symbols[s], period,t);

j++;

line[j] = iLow(symbols[s], period,t);

j++;

line[j] = iOpen(symbols[s], period,t);

j++;

line[j] = iClose(symbols[s], period,t);

j++;

line[j] = iVolume(symbols[s], period,t);

j++;

line[j] = iRSI(symbols[s], 0, 14, PRICE_CLOSE, t);

j++;

}

}

bool completed = true;

for(s=0; s<ArraySize(symbols); s++) {

if(line[6*s + 1]==0) {

completed = false;

break;

}

}

if(completed) break;

Sleep(200);

}

line[0] = timebase;

for(i=0; i<K-1; i++) {

for(j=0;j<ArraySize(line); j++) {

prices[i][j] = prices[i+1][j];

}

}

for(j=0; j<ArraySize(line); j++) {

prices[K-1][j] = line[j];

}

return (true);

}

## Sunday, February 27, 2011

### The contest

Participants were:

- LSSVM with polynomial kernel, with parameters (1,1)
- Simplistic as was described in a previous post

- 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)

eurchf | usdchf | usdjpy | gbpjpy | gbpusd | eurusd | |

LSSVM earn | 37 | -35 | 126 | 25 | 107 | 0 |

LSSVM bolli | 11 | 47 | 170 | 127 | 59 | 1 |

LSSVM rstuvw | 2 | -90 | 224 | 189 | 133 | 1 |

Simpl. earn | -10 | -43 | 517 | 89 | 419 | 31 |

Simpl. bolli | -133 | 0 | 198 | -320 | 133 | -251 |

Simpl. rstuvw | -65 | 1 | 623 | -117 | 386 | -476 |

- 360 minutes (six hours) from 3AM to 9AM Madrid Time as training data
- 24 hours, from the end of training (9AM) to 9AM the following day

*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.

- 24 hours as training data
- Risk and efficient portfolio of machines
- Which machines are again and again good for which FX.

## Friday, February 25, 2011

### Maximum profits indicator

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;

end

end

long = [long

profit];

% 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;

end

end

short = [short

profit];

end

## Thursday, February 24, 2011

### MQ4/Metatrader historical data bug

## 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

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:

## Saturday, February 19, 2011

### Simplistic explanation

*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...*).

*x*is a set of values (prices, indicators...) in the moment

*t*.

*f(x)<0*for negative cases.

*x*? In my first approach, I use only prices for one Forex (EURCHF) trade.

- High, Low, Open and close prices for each minute
- Volumes
- RSI
- for EURCHF, USDCHF, USDJPY, GBPJPY, GBPUSD and EURUSD
- 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

*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*.

## Wednesday, February 2, 2011

### Simplstic better than LSSVM

## Thursday, January 27, 2011

### Why are they earning?

## Thursday, January 20, 2011

### SimpleSVM with RSI limits for EURCHF: 9 to 4

## Friday, January 14, 2011

### SimpleSVM with RSI limits for EURCHF

## Tuesday, January 11, 2011

### RSI signaling for EURCHF

## Monday, January 10, 2011

### SimpleSVM with RSI limit for SP500 and EUREX

- Don't open long positions if not RSI (t-K)>70 and RSI(t-K/2)<70 and RSI(t)<70, at the same time, -for ascending trend-; don't open long positions if not RSI(t)>30 when prices are descending.
- Don't open long positions if RSI(t)>=70 when trend is ascending and don't open short positions when trend is descending and RSI(t-K)<30,RSI/t-K/2)>30, RSI(t)>30 are not verified.

## Friday, January 7, 2011

### About me

### ModifiedSVM for SP500 and EUROSTOXX

- For SP500 long prediction is quite good. SP500 is going up with a huge loses ModifiedSVM is avoiding. Short prediction is "almost" good: no points were predicted to get short.
- For EUROSTOXX, machine crashes: market was long, but, suddenly, (january 6th, at 13:30) it started to get very short. My ModifiedSVM decided to go in long at 13:30.... oohh!!!

- Samples each 15 minutes
- Training with 96 samples, the most recent ones
- Stop Loss decide after testing training, looking for the greatest benefit
- Two machines for each index: one for short and one for long positions.

- MQ4 code (working on MetaTrader) to get index values
- MQ4 code to operate in real time on MetaTrader platform
- Matlab to train and test the machine

### Presentation

Remember: I don't need you to visit this blog; I'm going to get rich, so go away! (And don't discover my secrets...)