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 = S1  Ewn = S1  (1/2n)Pw0(W-S-(n-2)I) =


Manipulating the expression after some algebra:


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


The series (S1  (1/2n) ) converges to 1, while the series (S1  (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,






                                                                               Go to Home Page