TSSF not giving accurate signals
Author: robinkno
Creation Date: 11/28/2019 12:47 AM
profile picture

robinkno

#1
I am using the TSSF position sizer on an EOD strategy. I have set the TSSF to trade very low equity (0.01%) when below the TSSF threshold and full trade size (5%) above the threshold and using Ghost trades.

When I run the strategy, alerts are produced and the position size is provided and based on the TSSF threshold it is either low or Full size. However the next day when I run the strategy the trade has been taken but the size is sometimes opposite to the alert. TSSF is calculated at the EOD and the new trades are entered at the open therefore no new exits are occurring before the trades are entered.

To try and determine what is going on I created spreadsheets with ALL trades from the simulation and then calculated the TSSF and applied that to the position sizes. The spreadsheet TSSF sizing did not always agree with the actual trade sizes.

To understand this better I went back to Mikhail Korolyuk’s (MK) article (https://web.archive.org/web/20140210034343/http://championship.mql4.com/2008/news/366).

The formula used by WL is:
Average Win / Absolute Average Loss / ( ((110% - %Win) / (%Win-10%) + 1) )

MK article states the formula as:
Avg.Win / Avg.Loss ((110% - %Win) / (%Win-10%) + 1)

Due to the lack of an operator between Avg.Loss and ((110% - %Win) this formula can be interpreted different ways:
1. the WL interpretation above.
2. Avg.Win / (Avg.Loss * ((110% - %Win) / (%Win-10%) + 1))
3. Avg.Win / Avg.Loss *((110% - %Win) / (%Win-10%) + 1)
4. (Avg.Win / Avg.Loss) *((110% - %Win) / (%Win-10%) + 1)

1 and 2 give the same answer and 3 and 4 give the same different answer. Which is correct?
I am assuming that ((110% - %Win) / (%Win-10%) + 1) is ((110% - %Win) / (%Win-10%)) + 1 and not (110% - %Win) / ((%Win-10%) + 1).

Algebraic formula can have multiplication implied eg. a*b = ab but a division is always shown eg a/b. That would suggest that interpretation 3 would be the correct one.

To try to see if I could come up with the correct interpretation I tried to recreate MK’s graphs for the Zero Return Curve and Safety Curve. I could not match his.
If I look at the simplest of the formula for the Zero Return line:
Avg.Win / Avg.Loss = (100% - %Win) / %Win where Win% = 50 and solve, the result is
Avg.Win / Avg.Loss = 1.
However his chart shows ~ 0.75. So are his graphs schematics and not actual solutions to his formulae.

To summarize, I am confused and would appreciate if someone can enlighten me. What am I missing?
Has anyone else tried to verify that the TSSF position sizer works as intended?
Is the formula in the TSSF code in the PosSizer the same as WL description?
Why do trade sizes change from alert to simulated trade?

Thanks for your help
Robin
profile picture

Eugene

#2
Hi Robin,

QUOTE:
The formula used by WL is:
Average Win / Absolute Average Loss / ( ((110% - %Win) / (%Win-10%) + 1) )

MK article states the formula as:
Avg.Win / Avg.Loss ((110% - %Win) / (%Win-10%) + 1)

I had the same feeling when trying to match his text to the graphs. Consider the Wiki example:

For the last 30 closed trades, your winning rate was 56%, the average winner and average losing trade were $590 and ($486) respectively. Consequently, the rolling TSSF ratio is 0.56 and it will apply to any new position being opened while your closed positions count isn't changed.

If we insert the numbers into the WL formula, we get this number:

590 / |-486| / ( (110 - 56) / (56 - 10) + 1) = 0.55

Let's do multiplication instead as MK's translated article implies:

$590 / |-$486| * ( (110 - 56%) / (56% - 10) + 1) = 1.21 / 2.17 = 2.63

Looks more reasonable? Now consider a system with average win of $590, average loss of -$580 and a win rate of 51%:
$590 / |-$580| * ( (110 - 51%) / (51% - 10) + 1) = 2.48 ???

It's basically breakeven but the TSSF is still high at 2.48. How come? Now with division the result is much more down to earth (0.42):

Average Win / Absolute Average Loss / ( ((110% - %Win) / (%Win-10%) + 1) )
590 / |-580| / ( (110 - 51%) / (51% - 10) + 1) = 1.02 / 2.44 = 0.42

Naturally 2.48 will result in a much higher position size than 0.42 but the system is only breakeven. A couple examples of more solid results to illustrate:

$5900 / |-$2800| * ( (110 - 71%) / (71% - 10) + 1) = 2.11 * 1.63 = 3.44
$59000 / |-$2800| * ( (110 - 71%) / (71% - 10) + 1) = 21.07 * 1.63 = 34.34

$5900 / |-$2800| / ( (110 - 71%) / (71% - 10) + 1) = 2.11 / 1.63 = 1.3
$59000 / |-$2800| / ( (110 - 71%) / (71% - 10) + 1) = 21.07 / 1.63 = 12.93

For stronger systems one'd prefer multiplication as division expectedly results in a lower TSSF number. Clearly there's a mismatch between his charts and the formula but I prefer to err on the side of caution. I've found the original article on TSSF in Russian by its author and here's a screenshot of the formula inside the PDF article. It's division so the PosSizer is working as intended:



CODE:
Please log in to see this code.


QUOTE:
and using Ghost trades.

You should avoid using this option altogether. It's where the instability is rooted. As states the TSSF online description:

Known issue: Backtests which use "Include raw trades..." may not be accurate i.e. results from running a backtest with TSSF may differ from such when TSSF is applied on-the-fly from the Position Size dropdown box. Avoid using this option until the bug is fixed.

My efforts to fix it weren't fruitful so I don't have short-term plans to fix it. For now you have to run your backtest with the option unchecked.
profile picture

robinkno

#3
Thanks Eugene.
I appreciate your finding the original Russian. That clarifies that aspect.
OK, I won't use Ghosts. Thanks again!
profile picture

Eugene

#4
You're welcome.

I'll upload a new build of MS123 PosSizers shortly. The checkbox will be disabled and the option ignored.
profile picture

Eugene

#5
Followup:

In MS123 PosSizers v2019.12 I've disabled the "Include raw trades (ghost trading)" checkbox until the bug is resolved. Its state is ignored by the TSSF PosSizer i.e. the option is always disabled.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).