T101 basket trading system - math analysis

 

Hi,

So, finally, my first thread here.. I hope you'll enjoy

Yesterday I started reading about Trader101 system described here: Basket Trading System, then the monstrous thread on the other forum. This system was made public by Trader101, also known as PipScorer.

In order to fully understand my thread, you need to get familiar with the rules of the system, as described in the above threads. I will make some small summary of the rules here, but for details you need to refer to original threads.

The rules are more or less like this:

You open demo account (I will refer to it as IA), and when each new week starts make following trades on it:

1. GBPUSD 8. EURUSD

2. EURGBP 9. USDJPY

3. GBPJPY 10. AUDUSD

4. USDCHF 11. NZDJPY

5. NZDUSD 12. GBPCHF

6. AUDJPY 13. CHFJPY

7. EURJPY 14 EURCHF

Trades 1-7 go short, trades 8-14 go long.

Then you sort them by profit they bring. When all buys are at bottom (i.e. they are all at loss) and all sells are at top (i.e. they are on profit), this is potential setup, and you will enter real trades soon, after some trend reversal confirmation. We call it their position 'slots' so the top positions are in slots 1-7 and the lower ones are in slots 8-14. Topmost trade (the one with highest profit) is in slot 1, bottom most (with highest loss) is in slot 14, and these two are named 'anchors'.

A confirmation might be, for example, when one of the buys starts to be positive enough to reach slot 1, or sell trade reach slot 14.

When you want to enter, you enter 14 pairs at once, all in the same direction (unlikely on the IA). The direction depends on what trades are occupying the bottom slots, you trade in their direction. So, if bottom is full of buys, you send 14 buys, if bottom is full of sells, you send 14 sells.

The exit is at your discretion, the proposed solution is to protect some profit. So, for example, once your total position reaches $100 in cumulative profit, you will close everything if the total cumulative profit falls back to $10 (so, you lock in $10 at $100). Then, you lock in more, as profit goes higher, so if you reach $200, you lock in $110, and so on. If you wont lock any profit, stop out at $-560 (assuming 0.1 lots, this gives 14 pairs * 40 pip loss).

This is very short story, the original consists of like 4000 posts (both forums combined), and there are many other nuances. Anyway, these rules are the one I want to focus on. For more details of the original strategy, please refer to threads mentioned above.

I am writing this thread, since I really miss the detailed explanation of the underlying math in this system. When I started reading about it, it looked nice, people were reporting huge profits, many indicators/eas/scripts/excel sheet/etc. were created, yet nobody digged why it work, how to make it better etc. A forum member named Slade had the most advanced analysis indicating that the system is very dependent on eur/jpy. This is correct conclusion, but still leaves many, many questions unanswered:

  • Why reset IA on each week? What will happen if you choose different method of resetting IA?
  • How this works? Why you buy or sell 14 pairs?
  • How the list of pairs was constructed? (This topic was explored already, I will recap it here, since I need it for further conclusions)
  • Is this some correlation/hedging strategy?
  • Why all trades on IA and on real are just 1 lot? This is imperfect. Will it help to make the IA hedge perfect?
  • The fluctuating profit on IA seems to be good indicator of setups. Why?
  • Why 14 pairs?
  • Why it makes a profit?
  • Why there is no stop loss or take profit?
  • .. and so on.

I will try to analyze these topics here, and provide as much answers as I can.

Lets start with the list of pairs, why there is 14 of them, and why in this configuration.

The answer is: they hedge each other. If you enter trade like this, you buy as much USD as you sell. You buy as much EUR as you sell, and so on. So, after opening 14 of such trades, your exposure is close to zero. If the hedge would be perfect, your exposure would be equal to zero.

Also, math is much easier if there is even number of pairs. It is possible to construct nicely hedged list e.g. of 11 pairs, but in such case original system will be biased toward sells or buys (though you can take it into consideration and adjust your trading).

The another nuance is that the more the better - you can go with just 3-4 pairs on the list, but with 14 they tend to average each other and you are less depending on single pair.

Here is a checkpoint - if you do not understand my text so far, the chances are that you wont understand remaining parts of this thread as well, as things will only get worse. And I'm not going to explain each and every detail, neither going down to 'i cant load this script' newbie questions. I consider this thread to use quite advanced math (well, there is nothing advanced here, but after reading 4000 posts from hundreds of posters and seeing almost nobody going so deep, I am starting to consider the basics covered here as advanced). Take it, or leave it, your choice. Intelligent questions are welcomed, of course.

Now, how this works? Why looking at 7 longs + 7 shorts give good signals to do 14 buys or 14 sells?

I have the answer, yet I need some examples to show it to you.

If we start IA as described above, the cumulative profit will stay the same over time (I will neglect the hedge imperfection here, will take it into consideration later). Yet, if you sort the pairs by profit, they will be jumping up and down, as the corresponding prices will go up and down. Moreover, there will be cycles (at least for some time, until prices will go off far away from each other).

Lets split the trades into two groups: group A consisting of 'top' trades (i.e. slots 1-7) and group B of bottom trades (slots 8-14). It doesnt matter if there are buys, sells, or mixed trades in the groups, just take a snapshot of their order on IA. This is moment t0 of time. Now, they will tend to shuffle between themselves, and sooner or later all (or almost all) trades from group A will be at loss, they will occupy slots 8-14. In the same time trades from group B, which were originally at loss, will occupy top slots (1-7), and be in profit. I'll call this moment of time t1.

The movement will be cyclic for some time, though if we wait long enough, the prices will change so much, that the cycles will take more and more time.

Please note, that we do not require any special order of trades within group. We only care if whole group is at bottom or at top.

Since, cumulative profit from all 14 trades is 0 (minus spread, swap and hedge imperfection), and top trades are positive, bottom must be negative.

Now, group B was negative at t0 and became positive at t1, right? All trades made at least few pips. This typically are hundreds of pips, not just 1. Of course between t0 and t1, large drawdown could appear, that is another story.

Also, all trades from group A were positive at t0 and negative at t1, so all of them lost at least few pips.

Now, what would happen if we would open 7 trades at t0, at pairs from group B, in direction from group B? All of them would move into profit!

If whole loss of group B was, for example, 100 pips in t0 and whole profit was 200 pips in t1, all trades from group B made 300 pips total, between those points. And our trades, entered live on t0, would make the same 300 pips.

Now, what if we would entered another 7 trades at t0, on pairs from group A, but in reversed direction? Since all trades from group A lost few pips, all our live trades would earn few pips! And we have 14 of them! If we catch 100 pip move on average, we could get 1400 pips from it!

And this is how this system works.

Please note, that my choice of group A and B could be just random snapshot of time. The original trader made simplification: waited until he will get buys and sells polarized - i.e. buys will all be at bottom or at all top. Then, he waited for some trend reversal confirmation, and made his t0 point. Surely, if whole group A consist of sells, and whole group B consist of buys, and our method need to open group B as is and group A reversed, we would end up with 14 buys or 14 sells! But this does not need to be the case.

I hope you are still following me... as the conclusions are much more interesting.

First of all, if you do the math correctly, the order of trades is not important. You can start your system at any second, and open trades immediately. They will just happen to not be all 14 in the same direction, thats all. But computer can track the direction easily. Of course, you want some trend reversal here, to match end of cycle - otherwise, you'll experience big drawdown before your trades get into profit.

There is more into that. In the original method, if you buy all 14, you'll end up buying eur 4 times, selling jpy 6 times, buying gbp, nzd and aud 2 times, selling chf and usd 2 times (+ opening some hedges).

But if you choose your group A/B split differently, this will also change! If you want until all jpy buy trades are in profit, then sell them, you'll end up just selling a lot of jpy against basket of currencies. Now, this is great for correlation trading, hedging and much more other strategies, isn't it?

You can also open 2 strategies at once, one e.g. against eur and the other buying chf (though you may need to construct different pair list to make better effect). Then hedge them all going long with eur/chf... lots of possibilities.

I just hit post length limit of this forum, so need to write rest of text in subsequent posts.

 

Continuation:

For example, you could switch direction of gbpusd, audjpy, nzdusd and usdchf to get resulting 4xeurjpy trade, straight, with no exposure in other currencies.

Then, you can trade just 0.1 lot, to reduce drawdown, margin and profit Also, this will be good trend reversal indicator for eur/jpy. Of course your group A cannot consist of just 7 buys (or sells), it will need 3 buys+4 sells on the appropriate pairs (or 4sells+3buys). Necessary math for this is your homework

There was also another interesting variation, when you enter only in topmost/bottommost 4 pairs, not 7. I did not analyzed this, but seems like subset of this system, with the remaining 6 pairs being just additional indicator.

Ok, lets move further - the hedge imperfection. Let assume that our IA is perfectly hedged. Then, everything above is definitely true. Lets assume that you entered 14 trades into 7 currencies (eur, usd, chf, jpy, aud, nzd and gbp), having effective exposure being zero on all of them (i.e. you bought 10000 eur and sold 10000 eur).

In this case, the cumulative profit on your IA will not move with the prices, it will be affected only by swaps. Also, you'll get better cycles, I think, without being biased towards any currency.

Now, lets assume that on your IA you bought slightly more eur, e.g. 10500, and sold slightly less usd, e.g. 9500. So, your total exposure is not 0 anymore, you are 500 units long into eur/usd now (bought at 1.0 rate). Of course this is not easy to construct such portfolio on MT4. On Oanda it is much easier, as they offer trade sizes of 1 unit, which is equal to 0.00001 lot. But, you can just go to bank and buy 9500 eur in bank notes

Anyway, lets analyze how such theoretical portfolio would behave. Surely, the cumulative profit would go up and down, oscillating for some time, responding closely to eur/usd price. If the eur/usd price would wander off, your IA total profit would stop oscillating and just show big number on either side of zero. But the idea of this system is to keep IA trades oscillating as much as possible, when this stops happening, you cant get any serious profit from this method.

So, basically such IA, and its cumulative profit will be working as oscillator showing when eur/usd is overbought/oversold. In the original system the hedge was not just 500 eur/usd, it was more complex, and varying over time. I did not calculated this, but I suspect that it is related to eur/jpy as well, since there is a lot of reports of this profit being good indicator, for example this:

"I saw a very interesting correlation between bottom number on the IA and signal. The magic number seem to be -$72.00. Whenever the loss exceeds 72 dol on IA go short and vice versa. I made at least 15 trades with this idea and everyone made money.Not sure why there is so much correlation with that number. Or may be just a coincidence." (EStrader, post #1633)

The easiest way would be to go to Oanda, open 14 buys, 100000 each, and take a look on exposure tab to see what is the final exposure. I did not go through it yet, but will do later. But if any of you can test it earlier, results (preferably with some screenshot) will be welcomed.

Now, next thought. People tend posting that eurusd+usdchf tend to be close to each other in the slots. Also, pairs like gbpusd+gbpjpy, eurusd+eurjpy, audusd+usdjpy tend to repel from each other. (Hndyman, #1830, and Trader101 in other posts, #1741).

Why is that? Why some pairs tend to be close and other tend to repel?

Lets analyze gbpusd+gbpjpy. What happens when usd/jpy sharply goes upward? Usd is gaining strength, jpy is losing. If gbp does not move in the same time, gbp/usd will go down and gbp/jpy will go up. So, they repel. What if usd/jpy sharply goes downward? They repel each other again, in the reverse direction. They stay next to each other only if usd/jpy stays in place. And usd/jpy is quite volatile pair, does make big moves. QED. Eur/chf is much more quiet, no big moves there, usually, hence, eur/usd and usd/chf stay to each other, influenced mostly by usd strength.

Ok, another variation, last one for today, lets name it '101 permutations'.

For simplification, lets use 4 pairs instead of 14. My list will be:

eur/usd, usd/chf, gbp/chf, eur/gbp.

Long eur/usd and usd/chf. Short gbp/chf and eur/gbp, so they are hedged.

Now, if you sort them by profit, they might order themselves in 24 different possible combinations. Lets suppose that we had a luck and after some time, in moment t0, they ordered in such way, that makes sells at top and buys at bottom, in this particular order: gbp/chf, eur/gbp, eur/usd, usd/chf, from top to bottom. Open such basket immediately. So, we have long on all pairs. Then, wait until at least pair of them jump, and there will be different order, even if still they will be polarized with buys at bottom. Open such combination as well. Then, wait for next jump and next configuration. If we already bought given configuration, do not buy it again. For example, if we'll see such order: eur/usd, gbp/chf, usd/chf, eur/gbp, we buy respective basket, if not bought already. By 'buying respective basket' i mean opening reversed position of top 2 slots and straight position of bottom 2 slots, so here it would be eur/usd short, gbp/chf long, usd/chf long, eur/gbp short.

Eventually, after some time, we'll see each of 24 combinations, and bought respective basket again, so we have 24*4=96 trades in total, 48 buys and 48 sells, 12 buys+12 sells on each pair. By definition, each buy will be at lower price than the sell. So, we have 48 buy+sell pairs, each of them captured positive profit. Close all of them, reset IA, and start from the beginning.

Nice, isnt it?

Of course the above is naive, the obvious optimization is to close opposing baskets immediately as they occur, so you close them earlier, pay smaller spread, and continue using this system forever. I'll write some small EA for this to see how big drawdowns we'll see along the way..

 

Nopik

Interesting indeed.

I spend most of my time programming, compared to trading. I gravitate toward semi-automatic EA's.

I did have some success in trading the T101 system, but I attribute most of that to beginners luck. I spent a lot of time writing my windows program (External IA monitor, posted in the FF forum). I generated a lot of data using the analysis functions of my monitor (exported to Excel), I didn't find anything consistently useful.

The "why it works" is why I believe a lot of people had a hard time understanding the T101 methodology. Your explanations are insightful. Thank you very much. Please continue.

Carl

 

dear sir,

i think the 14 pairs is founded by trader101 not only in the terms of "Corellations", some founder also trader101 use some terminologies like "jumping pair", "Extreme pair", "Middle pair" as it's simple meaning :

Support and Resistance / Pivot

when the pairs want to breakout from it's origin order, seems they act like we draw the pivot / support resistance line in the chart before they leaping up or leaping down other pairs in their order, so there are the patterns that still for us uncovered but for them is wide open.

The another key is the growing and shrinking of profit / loss in IA that's behave like volume in chart, it's surprise me but i still failed to get the key patterns,

maybe we could presented the data in form of statistic when they entry and when they exit as we might mapping the patterns what they called "trend or ranging" in their mind

These point i interpret for what they talking as crucial talk in one of most intriquing thread another forum, i just realize that it's only half of secrets,

Please apologize me if this post rather silly

 

Reply

@crodzilla: Hello Yeah, making this system automatic is quite a challenging task, I think I'll try to automate some of the variations first and will watch the Orest indicator for a while, so I'll get the feeling of the system.. maybe I'll catch something.

So far I wrote small screenshoting script which does screenshot the Orest at every candle beginning, so I have full folder of screenshots in regular interval now, so I can replay the movement.. yet it was not done systematically yet - today I'll try to add ftp function and put it into my vps, so it may work 24/7.

@primera: original poster also was talking about slightly different entry signal - when 2 pairs jump out of their slots and switch places, especially 7th and 8th slots, and/or anchor slots. That indeed may seem as supp/resistance, yet I'm afraid it is very weak one. Moreover, even the original poster mentioned that the winning % of such signal is much lower than the 14 pair entry - so I'm not focusing on it, at least not yet.

 

Buy-sell difference and Orest indicator

Today I was trying to focus on pinpointing good signals for entry.. this is the weak point of whole system.

While I had several ideas, most interesting to me is the buy-sell dollar profit difference. Namely, absolute amount of dollars generated by buy orders on IA should be equal to absolute amount of dollars generated by sell orders. I.e. these values should always be equal, but one is negative, while the other is positive. And they would oscillate around zero. They look like the chart in post #807, or #2786 or #1175 in the original thread. (Remember: we enter when red and green lines are far apart, hold until they cross and go apart on the other side, this is our greatest profit).

There was some interest about researching into this in the original thread, yet I think that this area is not explored well yet.

Anyway, this gives us some points to start with:

  • In perfect hedge, profit from buys and sells oscillate. So, we can try to catch extreme points and enter there. Or catch crossing through zero.
  • In imperfect hedge, the the difference between buy/sell profits is not zero. And it oscillates! It is shown by the yellow line on the screenshot above.

In the first issue, extreme points will be hard to catch, as we see on screenshots. Market is always making surprises and setting any fixed threshold is going to fail sooner or later.

Yet, it still can serve as aid - if profit from buys is far above zero and still growing, the trend is old and we're looking for reversals. Such approach will probably have quite good winning ratio.

The other issue, taking a look on the yellow line. It seems to keep around zero a lot, and any extremes are showing good points for entry/exit, obviously. So far this is the most promising idea for me now, yet I am afraid about that as IA gets old, the line stops oscillating around zero and goes away. Also, the screenshot from #1175 seems much more chaotic and yellow line is not so smooth, which worries me a little. But, it oscillates nicely, so there is hope

Afterall, yellow line is correlated strongly to exposure (by definition), so after adjusting exposure to be equal among currencies, we should smooth the line slightly, I would expect.

Another idea is to take currency strength into consideration (see post #1407). This is something I wanted to do in the first place, before I understood the system fully. Yet, there is still a lot of unexplored area there..

Now, the original issue why I started to write this post When I realized that we want to trade yellow line, I started to want it displayed somehow. And remembered, that Orest indicator does display its current value. Yet, yesterday I was watching the indicator for whole day and did not noticed that it is oscillating, or come anywhere to zero, even in range market. Then, I've got enlightenment: Orest indicator works in pips, not in dollars! Some posters already raised this argument in original thread, but they got ignored.. I ignored this problem as well, at the beginning. But it is fatal mistake! If we would compare a bunch of eur/usd trades together, it is fine, we dont care if we measure in pips or in dollars. But, we are measuring 14 different pairs, each with different tick/pip value! So, 100 pips in eur/chf is quite different to 100 pips on gbp/jpy.. The display is totally wrong! Why I didnt noticed it earlier?

I will modify the code to display dollar values, they will try to see how the yellow line behaves, we'll see.

PS. I'm now using Orest v1.12, which is the newest I've found. Yet, somebody mentioned v1.14, I didnt found it.. do you happen to have it?

 

orest indi

hope these helps you creating more insight study on BTS, i can't wait for more revealing the secret of currencies selections forming the buy table and sell table and their mechanism from Julius aka trader101.

If we found the exact formula's, the constanta and variables, i'm very sure we just not build 14 pairs, but we create such a the new model of pairing currencies mechanism that help us creating the basket.

anyway it's EA, not indicator, and sorry if i give these much, i really want helping someone to decode basket trading system in terms of analysis.

btw, i still have another "weapons" from that neighbour if you want but still thinking twice to put in forex-tsd coz i really want to avoid those b*st$rds that love to sell via EBay.

cheers

 

Thanks for the files, I actually found them myself earlier And yes, v1.12 is indicator, but it switched to ea in 1.14 or 1.13.

Well, the model is not so new, such tricks were known for long time already.. somehow I didnt interested in it earlier.

If you have some nice indicators which show historical graphs, preferably in $, not in pips, let me know, please. I've downloaded a bunch of them from ff (today just found some thread created by Orest, dedicated to T101 tools, so I have all from there).

 

you mean like this ?

double ProfitPair(int ai_0) {

string l_symbol_4;

double ld_12;

if (ai_0 == 1) l_symbol_4 = Pair.1st;

if (ai_0 == 2) l_symbol_4 = Pair.2nd;

if (ai_0 == 3) l_symbol_4 = Pair.3rd;

if (ai_0 == 4) l_symbol_4 = Pair.4th;

if (ai_0 == 5) l_symbol_4 = Pair.5th;

if (ai_0 == 6) l_symbol_4 = Pair.6th;

if (ai_0 == 7) l_symbol_4 = Pair.7th;

if (ai_0 == 8) l_symbol_4 = Pair.8th;

if (ai_0 == 9) l_symbol_4 = Pair.9th;

if (ai_0 == 10) l_symbol_4 = Pair.10th;

if (ai_0 == 11) l_symbol_4 = Pair.11th;

if (ai_0 == 12) l_symbol_4 = Pair.12th;

if (ai_0 == 13) l_symbol_4 = Pair.13th;

if (ai_0 == 14) l_symbol_4 = Pair.14th;

double ld_20 = MarketInfo(l_symbol_4, MODE_TICKVALUE) / MarketInfo(l_symbol_4, MODE_TICKSIZE) * MarketInfo(l_symbol_4, MODE_POINT);// calculates the value of the item pairs in the U.S

RefreshRates();// updates the value of tick

if (ai_0 < 8) ld_12 = (OpenWeek(l_symbol_4, ai_0) - MarketInfo(l_symbol_4, MODE_ASK)) / MarketInfo(l_symbol_4, MODE_POINT) * ld_20;// for the opening week of the village ASK ASK minus pair

else ld_12 = (MarketInfo(l_symbol_4, MODE_BID) - OpenWeek(l_symbol_4, ai_0)) / MarketInfo(l_symbol_4, MODE_POINT) * ld_20;// bai bid for a pair of minus bid beginning of the week

return (NormalizeDouble(ld_12 * Lot, 2));// multiplies the difference between the opening weeks of dollar value of the lot

}

iv'e found the bunch of code from samir universal indicator to convert pips in dollar, in orest thread too

 

Yeah, more or less. The conversion itself is not a problem at all, I just checked like 10 different indicators today, and all of them were in pips ;p

PS. Out of topic: The more MQL code I see the more I believe that MQL programmers do not know what a loop is... Instead of putting all symbol names into array and do just simple loop over the array, everybody just tends to write tons of lines (like this: "if(ai_0 == 1) l_symbol_4 = Pair.1st;" repeating everything, just on different pair.. what is your problem, coders?

 

How Perfect a Hedge is Best

Nopik, first thanks for doing this research.

I've always thought if the hedge is too perfect, the opportunity for profit would be less. I recall reading in Trader101 FF thread he stated the 14 pairs have an imbalance at some level so profit can be taken during swings without too much risk. So, it seems we are getting back to the typical risk vs profit balance.

Therefore, if you're suggesting adding a second chy/jpy for 15 pairs, that may reduce risk but wouldn't also reduce profit opportunities?

Rando

Reason: