Module 7, Lesson 1
SetStopContract vs SetStopPosition Impact & Specifics
Tomas: Hello, guys. It's Tomas, back here. This is a special module. I did not plan,
originally, to record this module, and actually it even happened that there is
one small thing, but quite important, that I have forgotten to mention in the
original content. So a little bit unplanned, here it is. It's an additional clarifica-
tion module. It's quite an important one, so please listen to it carefully, and
let me explain to you how this clarification module happened, why I'm re-
cording it now, a couple of weeks after releasing the original DPS course.
And also, this is going to be about clarification of stop-loss and specifically
about two EasyLanguage syntaxes, which are SetStopContract, versus
SetStopPosition, and its impact and specifics. So please listen to this carefully.
There's a lot I need to cover, and make yet clear, regarding the dynamic posi-
tion sizing concept, and the content I've shared with you already.
So first, a quick disclaimer, and now let's talk about what's going on here. So
all of this additional recording happened due to a fantastic post in the DPS
forum, posted by Oliver, and thank you very much, Oliver, for this, who just
brought up something quite important that I completely forgot about, and I'll
explain to you why I forgot, because there's a pretty pragmatic reason.
So Oliver says, "You drafted the code without any reference to SetStopPosi-
tion, or SetStopContract, thus it works with the default, which is SetStopPosi-
tion. I wonder whether SetStopContract would be more appropriate, espe-
cially for swing strategies, which uses stop-loss and a profit target, for exam-
ple ratio 1:2. With your method, it basically means that stop-loss or profit tar-
get are reached faster, since within the same boundaries you trade more
contracts. When changing to SetStopContract, the stop-loss and profit target
boundaries per contract would remain the same. Thus, this would be, timing-
wise, close to the original profit strategy. What is your experience with this?"
So let me clarify what's really going on. Whenever you work with more con-
tracts in TradeStation, like we do, in dynamic position sizing, there are basi-
cally two different ways to tell TradeStation how to work with these con-
tracts, and these both are related to stop-loss and also profit target. So the
Page 1 of 4
(c) 2018 [Link] / Distribution without author´s approval is not permitted.
TRADING INVOLVES A SUBSTANTIAL RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS,
PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS
first one is SetStopPosition, which is a default syntax. That's why you don't
see it in the code, right now, but that's what's automatically triggered, and
this basically means that the built in stops will be executed on a position ba-
sis.
So what it means; so right now, with the current version of the code, as you
have it, DPS, if we use stop-loss $1,000 US dollars, and if we trade two con-
tracts, then all of a sudden it means that actually what's going on is that this
stop-loss is shared equally between both contracts. So it's really decreased to
$500 per contract, because the default setup for multiple contracts is
SetStopPosition, which is by default. We don't need to write it as a syntax.
And by this default setting, it means that actually with more contracts, the
stop-loss is calculated on the overall position, including all the contracts.
So if we would trade three contracts, then stop-loss $1,000 dollars would be
equally divided into these three contracts, so each contract would all of a
sudden have $333 dollars stop-loss instead of $1,000.
Whereas if you use SetStopContract, which you need to specify specifically,
write as a syntax into your code, then it means that the stop-loss will be set
based on contract basis. So if you use stop-loss $1,000 dollars, then with two
contracts, that means you would use $2,000 dollars if the stop-loss would be
hit. Because now, with SetStopContract syntax, you would have $1,000 dol-
lars for each contract. So with three contracts, the overall stop-loss would be
actually $3,000 dollars, because $1,000 dollars per contract. Now, what really
happened here? In the original code, we don't have specification, whether it
is SetStopPosition or SetStopContract. That means, by default, TradeStation
calculates SetStopPosition, and that means if we increase the position it just
divides the stop-loss among all the contracts equally.
And by the way, this also applies to profit targets, okay? So if you use profit
targets, if you don't specify that the profit target is meant to be for a con-
tract, that means se SetStopContracts, then it will be used with this default
SetStopPosition. Okay, so the current situation in the DPS SmartCode is not
SetStopContract used, that means SetStopPosition is used by default. That
also means that, with two contracts, we are lowering the original stop-loss
per contract by 50%, from $1,500 to $750 USD. And with three contracts, by
33%, that means that now, from $1,500 dollars, we're basically lowering our
stop-loss to $500 dollars per contract only.
Page 2 of 4
(c) 2018 [Link] / Distribution without author´s approval is not permitted.
TRADING INVOLVES A SUBSTANTIAL RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS,
PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS
Now this is a great question. I'm really happy that Oliver brought this up, be-
cause this can even make an impression that in certain cases the big improve-
ment that we have been achieving with dynamic position is only due to the
reduction of stop-loss. So that could be a thought that some of you could
have right now. It's just like, "Okay, so the net profit draw down ratio has
been improved, just because all of a sudden we sliced the stop-loss by half, or
by 33%, just because we didn't specify that the SetStopPosition... that it's
meant to be for a contract." However, this is very, very far from the truth.
So first of all, if you go to this report, you will see that only minimum of
trades are stopped under basic stop-loss anyway. It is just a protective stop-
loss activated in minimum cases, and more importantly, it's always about
maximum adverse excursion, which is also quite, or sometimes even very,
different for each DPS appearance, and this is another magic behind dynamic
position sizing. That's the reason we can lower our stop-loss. So let me ex-
plain by a reply that I provided to Oliver in the forum, which you can see in
the dynamic position forums. So it goes like this.
The thing is that certain different market qualities, like for example different
market strands, different volatility, different market contraction, expansions,
also produce different maximum adverse excursions, which is very important,
and I have discovered this very accidentally when I added dynamic position
sizing to my trading strategy for the very first time, which was several years
ago. At that time, I only was playing with the very basics of this concept, and I
also wasn't aware of the default state or default setting in TradeStation,
which was SetStopPosition. So I wasn't aware that, now, with two contracts,
actually, the stop-loss per contract is just 50% than the original one. And then
I was really surprised at how come the results were so much better with the
ratio of stop-loss, which got 2:1.
That means that real stop-loss got half of the original value, as Oliver de-
scribed above, and surprisingly when I changed back to SetStopContracts, the
results got much worse, because logically you would expect, "Okay, we
should use SetStopContract." But when I changed it back to SetStopContract,
the results got worse. So I was really perplexed by this. I didn't understand
why was it, so I started investigating, and after investigation, I realized that
there were different maximum adverse excursions on the different dynamic
position sizing circumstances, which of course makes a lot of sense. So let's
say if we had dynamic position sizing based on volatility levels, it's logical that
different volatility levels will produce different maximum adverse excursion.
It's quite logical that a lower volatility level will produce lower maximum ad-
verse excursion, compared to higher volatility.
Page 3 of 4
(c) 2018 [Link] / Distribution without author´s approval is not permitted.
TRADING INVOLVES A SUBSTANTIAL RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS,
PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS
So that's also one of the reason why we could really see improvements with
slashing stop-loss to 50%, to half, because now we were really playing stop-
loss logically, with lower maximum adverse excursion. So in a sense, and that
was for Oliver, you could go even further with this, and optimize a different
stop-loss for every dynamic position circumstance, which would be right. If
you are more advanced, feel free to do this, and actually that's something
we're going to experiment with in our hedge fund next year, because we got
back to maximum adverse excursion recently and we're also scoping the op-
portunity to change stop-loss, let's say, more dynamically, or appropriately,
based on different dynamic position sizing circumstances.
So we will probably have individual stop-losses for that, which would be right,
as maximum adverse excursion will be different in many, if not most, cases.
So there are even more ways to play this. In the past, I worked with this ver-
sion as well. It all comes to individual strategies. Okay, so I hope this clarifies.
So it is a very important point for Oliver, and now, because the fair approach
to this is to really have the opportunity to test and compare both ap-
proaches. That means SetStopContract versus SetStopPosition. I've created a
slightly extended version of the dynamic position SmartCode which adds this
as another switch, so based on this communication with Oliver in the group,
and his help with bringing awareness to this, and making me aware that
that's something I've forgotten to mention which is quite important, I pre-
pared a slightly updated version of the SmartCode.
And it positions my SmartCode, which is basically the same code, but I just
only added one switch, and that switch is about testing both the SetStopCon-
tract and SetStopPosition. So, you will see this a new stop-loss type, and let
me show it in TradeStation.
Page 4 of 4
(c) 2018 [Link] / Distribution without author´s approval is not permitted.
TRADING INVOLVES A SUBSTANTIAL RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS,
PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS