Serving the Quantitative Finance Community

 
User avatar
milano
Topic Author
Posts: 0
Joined: August 6th, 2014, 11:50 am

stop loss and a take profit algorithm

November 15th, 2014, 4:41 am

good morning everyonecan you advise me how I can implement a stop loss and a take profit algorithm for pairs trading strategy ?thanks for your cooperationregards
 
User avatar
acastaldo
Posts: 14
Joined: October 11th, 2002, 11:24 pm

stop loss and a take profit algorithm

November 15th, 2014, 10:59 pm

As you know, in pairs trading you enter a trade when the residual (or mispricing or cointegration error) reaches a certain value say -2 standard deviations and you exit when it reaches say +1 standard deviations.Because +1 > -2 this exit is a take profit exit, in the sense that you make a profit since the mispricing has been reduced (and has even changed sign from - to + in this example). So I don't understand what you mean by adding a take profit exit, you already have one.On the other, to add a stop loss exit, you would also exit in case the mispricing becomes sufficiently worse. So for example you might also exit if the mispricing reaches -3.5 standard deviations.So in summary: enter at K1 (-2 sigma in the example), exit with profit at K2 (+1 sigma in the example) or exit with stop loss at K3 (-3.5 sigma in this example).HTH
 
User avatar
milano
Topic Author
Posts: 0
Joined: August 6th, 2014, 11:50 am

stop loss and a take profit algorithm

November 16th, 2014, 3:36 am

Thank you again for your cooperation, you always help me.I've attached the graph of my strategythe black line is my entry signal or the output signal of the position and the others are the thresholds.I set six different thresholds and I obtain a decent profit, but I don?t want my profit to decrease.To sum up in this graph how can I interpret the stop loss and take profit algorithms to obtain an always increasing gain?Thanks again.