Pairs generator

volatileN

Member
Messages
93
Likes
0
I have finally refined my pairs generator...

Have a look at the spreads attached to the next few messages...
 

Attachments

  • spread#5.jpg
    spread#5.jpg
    30 KB · Views: 731
As well as a high correlation and a fast speed of mean reversion I am also scanning for a flat gradient of the OLS regression line (plotted)...
 

Attachments

  • spread#2.jpg
    spread#2.jpg
    33.6 KB · Views: 480
Sorry, just to clarify, the x axis is the number of days we are looking back, the Y is the price ratio (x/y).
 
Since I did not follow this in a previous thread please could you elucidate?
Rangebound nature is interesting
 
twalker said:
Since I did not follow this in a previous thread please could you elucidate?
Rangebound nature is interesting

Sure.

I am refining an automated pairs trading system which scans the prices of every potential pair from a universe of stocks (S&P 500 in this case).

It then reduces these down to those which have a > x% correlation over y days and an a% correlation over b days (where b<y).

Then it sorts these pairs into those with a gradient of the line of best fit of between m and n (low as trending spreads are perceived to be more risky).

Finally it assesses the previous speed of mean reversion and attributes probabilities to mean reversion of diverged spreads and ranks these.

The probabilities are based on the historic distribution of that spread and a few technical indicators.

Once this is done the program (will, not quite there yet) outputs which spreads to buy and sell and where to place the stop.

As the system is based on the supposition that historic mean reversion / correlation will persist it uses tight stops (so the loss when the relationship does not hold is half of that when it does).

This way gains are always twice the size of losses and occur more frequently.

It has taken time to get to this but I am delighted with the results! It remains computer intensive and needs refinement but I am close!
 
This is exactly the kind of system I had been hoping to develop, but haven't had the opportunity yet as I've been working full time and also part time so no time left!

Are there any more details you're willing to post?
 
gbr128 said:
This is exactly the kind of system I had been hoping to develop, but haven't had the opportunity yet as I've been working full time and also part time so no time left!

Are there any more details you're willing to post?


I am happy to divulge a certain amount, but not 100% as it works so well!

What would you like to know?
 
I got as far as calculating the 6-month correlation for every pair in the FTSE on some test data I have. Many pairs had high correlations but didn't look like they'd be any use for trading the spread.

So I guess my question is how you calculate your line of best fit? And do you then use that as the trigger point or do you use the mean of the spread?
 
VN - I'd settle for an explanation of the part of your system which "scans the prices of every potential pair from a universe of stocks ".

What product do you use to scan?

How do you populate that scanner with stocks in the first place (i.e. on what basis/criteria do YOU decide to enter a stock for future processing (or is that automated too)?

And how do you determine what is a potential pair on a dynamic basis?
 
VolatileN,

Well done, your approach looks highly promising and I hope you get the refinements sorted out.


Paul
 
gbr128 said:
I got as far as calculating the 6-month correlation for every pair in the FTSE on some test data I have. Many pairs had high correlations but didn't look like they'd be any use for trading the spread.

So I guess my question is how you calculate your line of best fit? And do you then use that as the trigger point or do you use the mean of the spread?

For a comprehensive discussion of how to calculate the line of best fit see http://www.statsoftinc.com/textbook/stmulreg.html

The slope of the line of best fit is a requirement for any spread to be included in my universe of candidates. Trigger points are then generated according to deviations from the line conforming to a few basic technical criteria.
 
TheBramble said:
VN - I'd settle for an explanation of the part of your system which "scans the prices of every potential pair from a universe of stocks ".

What product do you use to scan?

How do you populate that scanner with stocks in the first place (i.e. on what basis/criteria do YOU decide to enter a stock for future processing (or is that automated too)?

And how do you determine what is a potential pair on a dynamic basis?

I am building my own product in Java. It is not finished yet, at the moment it is a just a VBA application.

What I did was fill two workbooks with the last 5 years of daily price data from the S&P 500 (a pain in the arse, I tried doing it manually from Datastream at first before finding that Bloomberg does it really quickly).

The stocks entered for processing are just those in the S&P 500.

Doing it dynamically is currently very clumsy as I have to re enter the last 5 years of data every day direct from Bloomberg. Once my Java application is up and running I will use a live feed into a sql database and the data will be continuously scanned on a dedicated PC in there.

I am still exploring the relative merits of sector neutrality. Being sector neutral offers fewer triggers but they are right more often. We will see what the backtest shows up when it is complete...
 
I had always planned to just trade pairs from the same or closely related sectors, so was looking to do this across Europe. I thought that anything else would be like betting on ships that pass in the night.

Thanks for the link, will take a look.

I have a half-built TA system in Java running from a mySQL DB. All seems pretty good so far, except it'll never be finished! Give me a shout if you need any assistance.
 
gbr128 said:
I had always planned to just trade pairs from the same or closely related sectors, so was looking to do this across Europe. I thought that anything else would be like betting on ships that pass in the night.

Thanks for the link, will take a look.

I have a half-built TA system in Java running from a mySQL DB. All seems pretty good so far, except it'll never be finished! Give me a shout if you need any assistance.

I will do. Mine will also be a bit slow in completion I fear as I have so much else on. I am determined to have it fully functional, automated and executing orders in my abscence by Q4 this year though. In the mean time the VBA version is fine for research.

PM me later this year and we will catch up on progress...
 
VolatileN,
Are you planning on incorporating this system into the software you're designing that you were talking about in the other thread I was on (about oz markets?). Or is that a whole seperate suite of progs altogether?

CK
 
charlesk said:
VolatileN,
Are you planning on incorporating this system into the software you're designing that you were talking about in the other thread I was on (about oz markets?). Or is that a whole seperate suite of progs altogether?

CK

I *might* incorporate it as an add in, or produce it as a stand alone package or just keep running it for myself. I have as yet to weigh up what I would gain in sales revenue relative to the loss of what I perceive to be some of my best IP.

What do you think?
 
Well VolatileN, that's a tricky question to answer. From my point of view, I think you should make it available, but that's because I'm interested in making profits etc. However if I was in your shoes, there's a few different options to consider, and few different ways to go about it.

It would all depend on exactly how successful your system is both for you, and how easy it would be for someone else to follow it, depending on how much training/coaching might be required.

You could;
1. Write the program as a standalone blackbox that doesn't exactly show how it comes up with it's buy/sell signals. That way any idiot could run it and make profits.
2. You could sell the strategy while not actually selling the computer program. That way it would be left for the buyers of your strategy to identify the buy/sell signals themselves according to the "rules" you have given them. This method would always give you plausible deniability if they make losses, ie "Well you didn't follow the system correctly" etc etc
3. Like some other places, you could create a subscription service where you would simply email out recommendations daily as they occur. This way you would retain the EXACT method of identifying buy/sell opportunities. You would still have to explain in a rough idea what you're doing to get ppl interested in the first place. You could even write a program that would automatically create/send the emails as it identifies trades realtime. That way you can sit back and just collect the subscriptions from everyone, requiring little daily input from yourself.

Finally the decision to make is WHEN to start selling the program. You could profit from your system for the next 10 years, and then when you're ready to retire, start selling the program/strategy to make money on the side while you're retired?

At the end of the day though, you've done the hard work, and you should obviously profit in some way from it. I'm rather jealous, however I've only been trading for about 4 months now, so I'm soaking up everything like a sponge, learning!! :LOL: I'm still trying to decipher your previous posts and wading through the terminology!!!
 
Top