Cointegration-/Pairs-Trading

FTMO Trader Scouting
Status
Not open for further replies.
TopFroxx said:
btw i didnt forget about this. i tried but could not find any significant pattern comparing relative currency positions vs equity. maybe it's neccessary to adjust the relative positions with the historical performance of that currency in some way.
but maybe i am just blind. attached you find the aggregated realtive positions for each currency. they are realtive to the overall portfolio, so they all add up to 1. the black line is the scaled equity curve. historical performance over the past ~2 years. if anyone can find a pattern in there that i cant see, please let me know :)

This is cool. You pretty much got it...

Pattern wise, one thing stand out: Swings in your P/L happen most often around drastic changes to your weighting, which suggests the P/L is 'realized' only and not including floating P/L from open trades.

Any chance you can add in another line for 'unrealized + net'?
 
Jack said:
This is cool. You pretty much got it...

Pattern wise, one thing stand out: Swings in your P/L happen most often around drastic changes to your weighting, which suggests the P/L is 'realized' only and not including floating P/L from open trades.

Any chance you can add in another line for 'unrealized + net'?

actually this IS the equity curve including unrealized profits! now the question is, what this could mean. i need to have another look
 
i think this just reflects the approach of the strategy. because i am always invested, the equity curve reflects the price movements of the currencies to some extent. so once currency pairs (that i am invested in) break out and make a bigger move, the strategy reacts. it will either close some positions, because they hit the "SL" or the strategy sees this as perfect opportunities to invest, because certain currencies (those that shouldnt, because they are cointegrated) will drift apart when bigger moves happen, and thus the positions will be increased. the latter case is the more likely one. this is why the equity curve becomes more unstable, it's just higher exposure.
or am i missing something? what would be your explanation and maybe advice to possibly improve the strategy, given the graph?
 
TopFroxx said:
i think this just reflects the approach of the strategy. because i am always invested, the equity curve reflects the price movements of the currencies to some extent. so once currency pairs (that i am invested in) break out and make a bigger move, the strategy reacts. it will either close some positions, because they hit the "SL" or the strategy sees this as perfect opportunities to invest, because certain currencies (those that shouldnt, because they are cointegrated) will drift apart when bigger moves happen, and thus the positions will be increased. the latter case is the more likely one. this is why the equity curve becomes more unstable, it's just higher exposure.
or am i missing something? what would be your explanation and maybe advice to possibly improve the strategy, given the graph?

That makes sense then; like around your sample #400 when you get a spike down in equity as your strategy loads up on USD and YEN as it drops NZD and others.. as that price relationship soon reverts back to a mean (and thus, you profit) your strategy reverts back to a more balanced weighting right as your P/L shoots back up with realized gains.

rNngYel.png


Another thought about the graph: How is it representing short vs long net exposure on a given currency?

Also, leverage in use is pretty important as well. Instead of just stopping at 1 for allocated weighting, is there any way to extend this as a measure of leverage used as well? I mean, say if you're using 5:1 leverage most of the time, then the vertical axis could go as high as the max leverage you've used historically but be 'white' or 'clear' between this 'peak' point and the current level you're using. (So if 5:1 was your max, then 5 would be the highest value, and 1 would be equal to your account in value or 1:1 in leverage.)

Honestly, the more I think about this kinda visualization, the more I wonder why there isn't software that does this out of the box already... most brokers only provide a simple equity curve.. and even MyFXBook doesn't plot out leverage in use as another dataset alongside equity or return.

hmmm...
 
Other thoughts: You could use instances like the account activity I pointed out in the last post to compare your strategy to one that's not always invested.

I mean, while your strategy does have periods of slow and steady gains, quite a few of your biggest profit runs come from just a few trades in succession.. which makes me wonder if waiting for a scenario where your system would normally get heavily exposed to a given price relationship thanks to a larger move (that is to say, something triggering your system to load up more than usual,) and then opening a position from an otherwise flat account would yield better overall results. -- Or, if not better overall, then resulting in lower risk taken on to achieve the same results, which then allows you to leverage up a bit more without pushing the risk beyond what you're already seeing.
 
Jack said:
Other thoughts: You could use instances like the account activity I pointed out in the last post to compare your strategy to one that's not always invested.

I mean, while your strategy does have periods of slow and steady gains, quite a few of your biggest profit runs come from just a few trades in succession.. which makes me wonder if waiting for a scenario where your system would normally get heavily exposed to a given price relationship thanks to a larger move (that is to say, something triggering your system to load up more than usual,) and then opening a position from an otherwise flat account would yield better overall results. -- Or, if not better overall, then resulting in lower risk taken on to achieve the same results, which then allows you to leverage up a bit more without pushing the risk beyond what you're already seeing.

thank you for the input jack, very much appreciated.
will have a look and post a chart soon. not sure if i understood correctly, but i will create a chart that is not showing relative positions to the overall portfolio but absolute positions. that way it can be seen how the overall investment value increases or decreases over time. so basically it will just show the amount of "units" traded.
regarding longs vs shorts: for the last graph i added up longs and shorts, meaning -1 position usd and +1 position in usd is actually 2 usd positions and not 0. i just wanted to show the overall investment in any one currency. but now that i think about it, i am not as sure about the usefulness of that anymore.
for the next chart i will make it so that 1-1=0.
regarding only trading in certain environments to get the bigger moves: will have a look at that although i need to say this chart and the sample is probably not really that representative. if you look at post 1 of the thread and the equity curve there were also long steady increases, not driven by single events.

so much to do.. also wanted to delve into a total new concept based on evaluating formations of swings. basically trying to determine impulsive and corrective moves (similar basic concept as elliot waves, but not as stringent with the counts) and based on those giving probabilites for the next likely wave direction. next step would be to evaluate on different (lower) timeframes for timing potential entries. but thats far in the future (edit: not as far in the future as i thought, lol).
 
just a short update: the account is still in slow and steady drawdown, mostly because of longs vs the yen and eg long. equity dropped to 114% of initial deposit. about in a 19% dd currently
 
TopFroxx said:
just a short update: the account is still in slow and steady drawdown, mostly because of longs vs the yen and eg long. equity dropped to 114% of initial deposit. about in a 19% dd currently

How long has your models spent in extended draw down during your backtesting?

Is there an average trough to peak?
 
Jack said:
How long has your models spent in extended draw down during your backtesting?

Is there an average trough to peak?

historically it can take up to 100 days, but that is the longest period i could find. average is more like 60 or so. but yeah, it can take a while.
 
Hey TopFroxx,

Many thanks for the time and effort you have invested on this thread. I found your experience very valuable for my purposes. I am also trying to define a strategy concept applying cointegration on currencies. I am basing most of the concept on this document: http://www.ljmu.ac.uk/Images_Everyone/ArtCDJLAS_0410.pdf. You would help me a lot if you can describe better the details of your concept. Do you make Johansen test for cointegration on all the currency pairs?, What is the logic developed on matlab?, What is the logic calculating the weigh on each currency in the basket?
 
hlopez60 said:
Hey TopFroxx,

Many thanks for the time and effort you have invested on this thread. I found your experience very valuable for my purposes. I am also trying to define a strategy concept applying cointegration on currencies. I am basing most of the concept on this document: http://www.ljmu.ac.uk/Images_Everyone/ArtCDJLAS_0410.pdf. You would help me a lot if you can describe better the details of your concept. Do you make Johansen test for cointegration on all the currency pairs?, What is the logic developed on matlab?, What is the logic calculating the weigh on each currency in the basket?

Welcome to the forum! :)
 
Hey Top,

Remind me, what are you using for your stat analysis again?

I've just dove into a DIY effort (avoiding the software I talked with you about before, not that it's bad, just can't integrate it into other code I've written easily,) using Python and Pandas...

So far so good, but I'm so green with Pandas I'm still in the stage of watching into videos like this. (Only used a URL shortener on that last link because I didn't want the forum to auto embed it as a youtube video.. it's just a youtube link, nothing funky.)

I like it, and on paper is has more than I could ever need data analysis wise, but perhaps there's an easier solution...
 
Jack said:
Hey Top,

Remind me, what are you using for your stat analysis again?

I've just dove into a DIY effort (avoiding the software I talked with you about before, not that it's bad, just can't integrate it into other code I've written easily,) using Python and Pandas...

So far so good, but I'm so green with Pandas I'm still in the stage of watching into videos like this. (Only used a URL shortener on that last link because I didn't want the forum to auto embed it as a youtube video.. it's just a youtube link, nothing funky.)

I like it, and on paper is has more than I could ever need data analysis wise, but perhaps there's an easier solution...

hey jack,

i use matlab. but not because it is a good program for statistical analysis (many argue quite the opposite actually), but more for the simple reason that i know how to code matlab from my university background.
cant really tell you anything about other software/languages. sorry
 
Hi TopFroxx,
Very interesting thread. I am interested in automizing your strategy, do you think it is possible ? How is your current equity growth chart ?

Best
 
maybe one final reply to this thread, then it could be closed as far as i am concerned.

i stopped actively trading this strategy a couple of months ago already. equity movements were a bit different from what should have been, looking at historical performance. i pulled the emergency break on a extended period of drawdown and closed the account with a roughly 8% profit. since then the "project" is pretty much on ice. i have had a couple of other ideas for quantified systems. one of which is based on daily PA that i am using live. had a strong initial move up in equity, now hovering at a small drawdown for ~2 months. out of sample hitrate is ~60%, with a bit better than 1:1 realized RR. so that's not too bad.
to apply the other idea in live trading i needed an indicator, thus the "looking for an indicator.." thread. thanks to rod, i can now apply that strategy. have not had a signal yet though, so still looking forward to live results.
aaaanyway, back to topic. i have not looked at the cointegration strategy again, since a couple of moths ago. i plugged in the recent price history to see what this strategy would have produced these last months. not so impressive. just slightly positive with some big swings in equity.
so yes, for me this cointegration thing is "dead", especially since i have found easier and potentially more profitable mechanical strategies.
 
Status
Not open for further replies.
FTMO Trader Scouting
Back
Top