How to modify TP/SL levels as the price moves?

 

Hi,

how would I go about setting multiple TP/SL levels? I've finally managed to make my strategy work but the performance is awful. I would like to set multiple levels such as:

if (trigger == true)
{
     buy or sell
}

-------------------

position == open
tp = +50pips
current price = +49pips
current price = +42pips
current price = +37pips
current price = +33pips
close position while in profit
if my TP is 50pips and SL 20 pips and the price moves 49pips and turns around, how can I prevent from losing the trade and ending up being in at least positive zero? I would like to activate the first SL level when the price moves +10 pips and the second one when the price moves +20pips so I don't end up going negative, any suggestions?
 
You want to set a trailing SL ? plenty of posts about trailing stop loss, use the search box top right of this page.
 
Thank you RaptorUK. I'll do a research on that and get back to this thread when I have a specific question.
Reason: