In this post I want to show how to build a basic swing trading system. Furthermore I want to document my thought process behind the various elements as well as introducing some new ideas. As all of my posts, this post has also a primary objective: answer the question how TSI can be used in combination with other indicators such as RSI(2).
Let me clearly state that I do not trade this system outlined below, though i use some of the principles. Anyhow, I believe for many of you this could be a good start..
.
System goals
- The system should be traded end of day (as many readers of this blog have another job).
- Emotionally easy to trade: long-only trading and a high number of winners!
- Attractive risk-reward: buy into short-term weakness, sell into strength.
- Use money management to improve performance.
.
Trading vehicle
The system will be tested on the German DAX (cash index). I simply use the DAX because in previous TSI related posts I’ve focused on the NDX100 index as well as stocks. The principle of the system will also work on other stocks or ETFs, but it might be necessary to slightly adapt it.
.
Trend
I like to have multiple (different) trend filters in a system. Because this way I’m not relaying to have found THE best trend filter. So let’s stick with the close above the average of the last 50 days or a rate of change of the last 150 days greater zero. There might be other options to defined a market, but that’s not the point of this post. I want you to make aware to think of multiple alternatives with different periods.
.
Buy into weakness and sell into strength.
Short-term weakness can be identified in a number of ways: price movement from recent high, number of bars bellow a moving average or a specific indicators value (RSI / DVO). For simplicity reasons i’m going to use RSI(2).
.
Let’s set the baseline.
Based on this we can already build a system skeleton and set this as our initial benchmark to compare with for further improvement.
All trades are taken close / close (= end of day). Trades are closed once RSI(2)>50. Position size is defined as 33% of equity. Position size of open trades can be increased (=scale in) in case an additional entry with a lower entry price is given. I’m doing this for two reasons: 1.) not to rely on the fact to have found the single best RSI entry value and 2.) to get more trades as I start with a smaller position size and can therefore take trades earlier (=higher RSI(2) value) as my risk is reduced.
There are two RSI entry values to be identified. The first one is the entry value for trading when the trend condition (Close>MA50 or ROC(150)>0) is meet and the second RSI value is the one for trades in case our trend condition isn’t meet.
Let me show you two very different outcomes
a.) High CAR, low system quality numbers
b.) Lower CAR, high system quality numbers
What’s the take away from this? Lower RSI entry values produce higher quality trades while reducing the opportunity (=number of trades) significantly. You probably knew that already. Furthermore youcan see that trading against the trend filter is less attractive than trading with the trend (from a high level perspective). Again, this is just the initial benchmark.
.
Let’s bring TSI into the game.
TSI is an indicator described here. The idea is to have TSI to help define if the market is in a trending environment. So let’s define a TSI > 1.65 as trending vs non-trending. So in total we have a matrix of 4 RSI entry values:
Long condition is given (Close > MA(50) or ROC(150)>0)
- RSI1: TSI>1.65
- RSI2: TSI<1.65
Long condition is NOT given
- RSI3: TSI>1.65
- RSI4: TSI<1.65
As time and words are limited on this blog I will come up with the best setting and results right away.
The entry values make a lot of sense. Higher values (=earlier entry) when the market is in an uptrend (=True) and lower values (=later entry) when the market isn’t in an uptrend. Furthermore we have consistency in TSI separation. High TSI = earlier entry, low TSI = later entry. Looking at the key performance indicators you can see an improvement on absolute returns as well as risk adjusted returns. That’s what we expect from introducing additional complexity to a system. Furthermore the principle is sound and has been tested in other markets as well.
.
But hold on, we aren’t done yet!
In part two of this series we are going to look at the exit which is as important as the entry. Furthermore i will post the source code.



Apologies if I’ve missed this, but how long is the back-test?
Hi Rob,
it’s 1999, sorry for not stating this. You will also see it in the source code (to be posted).
Best,
Frank
Thanks. Includes several different regimes, so should be pretty robust.
I must have missed it. What are the RSI values used for entry?
~Freeman
Hello Freeman,
the system uses 4 different entries, depending on the overall trend and trend strength (Matrix).
Read section: “Let’s bring TSI into the game.”, please
Frank
Freeman asked about the RSI values and I have the same question. Are you using any RSI(2) threshhold values such as a cross of the 30 level for a long signal?
As I’m sure you know, RSI’s have threshold cross-numbers but you don’t mention which ones you are using or more likely I (and Freeman aboe) are misunderstanding your use of RSI here. Please clarify.
Thanks for the great work.
Hi Keane,
there is a big green/orange box at the end of the post. Hope you can see that and there are no technical problems with the blog. Exit is done when RSI2>50.
Entry
- with the trend and low tsi: RSI2<8
- with the trend and high tsi: RSI2<18
- against the trend and low tsi: RSI2<2
- against the trend and high tsi: RSI2<13
Frank
Since TSI is a nondirectional indicator I find it puzzling you use a higher RSI value when long condition is not met. This woul;d suggest markey is in a strong downtrend, hence should have a lower RSI
Hello Alphadog,
the idea is: if TSI is < 1.65 the market is sideway/non-trending hence an entry should occour faster than in a trending market. Second, you want to enter your long trade "later" in a bear market.
I posted this a long time ago…. Today I would pay more attention to intermediate term conditions…
Frank
Hi Frank,
On a private board someone asked for the thinkscript code of your TSI.
thinkscript is the coding language for thinkDesktop by Thinkorswim.com. Here you have the TOS-study for your visitors too. If you like, I could provide a chart also.
BTW, in the code I use TSX instead of TSI, because most of the time TSI refers to the True Strength Index, published in 1991 by William Blau. I guess he was first
Question: are the entry and exit values of RSI(2) still valid and is your market filter still 50MA & 150ROC or do you use the tandem 20MA & 200MA instead as a filter?
I’m planning to implement the entry and exit levels in a system for TOS.
Thanks for all the work you offer for free!
JW
# — begin script —
# Trend Strength Index TSX
# original by Frank Hassler
# http://engineering-returns.com/
declare lower;
input price = close;
#input lengthATR = 10;
#input lengthROC = 10;
input fastMA = 10;
input slowMA = 100;
input lineValue = 1.65;
def ATR = AvgTrueRange(high, close, low, 10);
def Ratio = AbsValue(close – close[10]) / ATR;
plot TSX = Average(Average(Ratio, fastMA),slowMA);
TSX.SetDefaultColor(GetColor(1));
TSX.setLineWeight(2);
plot line = lineValue;
line.setDefaultColor(GetColor(5));
# — end script —
Hello JW
THANKS a lot for the code…
I don’t trade that system at all. It only served as an example.
But to answer your question: i’m not a big fan of these MA/ROC based filters. More often they are just a moderator for a different volatility regime.
Regards,
Frank