Go to Home Page

The Flaw in Trailing Stop Algorithm

This is an email to a client that was requesting the implementation of a trade algorithm that consisted in the following curious scheme:

#include refused to take this client's money for the implementation of the above deceiving trading strategy. Here's the email explaining the refusal.

 

*****

 

When you first mentioned this trailing stop concept, I must confess that my first reaction was – why didn’t I think of that?. Then I thought, maybe it is just a mirage, let’s do the math (even if you didn’t pay me for it). The math was tricky and in my first attempt, I made a couple of algebraic mistakes that got me a positive expectancy and so I told you. Today, I went back to my pencil and paper…and news aren’t good.

 

Follow me through the math of the Trailing Stop:

 

Let’s assume that the probability of hitting the initial profit target W and so, of initiating the trailing stop algorithm, is Pw0 (your chances of losing before starting with the trailing stop is then (1-Pw0)). At the point when you reach target W, you set the stop loss at W – I, and the new target at W + I, where I is the increment. At that point, your chances of stopping the trade or going ahead are 50/50, in other words, the probability is ½. The shortest path to a win is when w-I is hit. The probability of this path is Pw1:

 

Pw1 = ½ Pw0

 

The winning for such path is W-S-I, where S is the spread and fees. The average winning for such a path, in math jargon the mathematical expectancy, would be:

 

Ew1 = Pw1 (W-S-I) = ½ Pw0 (W-S-I)

 

If you kept winning and it hit the W+I target, then you set the stop loss L at W and the new target at W + 2I; you are again at the 50/50 situation. If you hit the W, you are out with a win of (W-S–0I)  The probability of this second path is:

 

Pw2 = ½ Pw1 = ¼ Pw0

 

And the expectancy:

 

Ew2 = ¼ Pw0 (W-S-0I)

 

For the nth path:

 

Ewn = (1/2n)Pw0(W-S-(n-2)I)

 

Total winning expectancy would be the sum over all possible paths, or in other words, the sum from 1 to ¥:

 

Ew = S¥1  Ewn = S¥1  (1/2n)Pw0(W-S-(n-2)I) =

 

Manipulating the expression after some algebra:

 

Ew = Pw0 ( (W-S+2I) (S¥1  (1/2n) ) - I(S¥1  (n/2n)) )

 

The series (S¥1  (1/2n) ) converges to 1, while the series (S¥1  (n/2n)) ) converges to 2 (if you don’t trust this assertion, check it with EXCEL).  Replacing these values in the expression for Ew:

 

Ew = Pw0(W-S)

 

Since Ew is not depending at all on the increment I, it could very well be zero, this already means that the trailing stop is doing nothing! But let’s continue…

 

Now the probability of losing is (1 - Pw0), and the loss is (L+S), the average loss:

 

EL = (1-Pw0)(L+S)

 

The total outcome expectancy is:

 

ET = (Ew - EL) = -S + (W*Pw0 - L(1-Pw0))

 

Now, Pw0 is the probability of the quotes hitting W without hitting L, according to the random walker theorem (that I know you don’t believe in):

 

Pw0 = L/(L+W)

 

If you substitute this into the ET expression you get the bad news:

 

ET = -S

 

In the long run you'll lose the cost of the transactions. So don’t bother introducing this complication,

 

Sorry!

 

Armando

 

                                                                               Go to Home Page