Modify a Stop Loss into a Trailing Stop when a Take Profit is reached

 

Hi to everyone,

first of all, I'm sorry if my english or terminology could cause any misunderstanding, I will try to be as clear as possible.

For an EA that I'm developing, I would like to cancel the StopLoss and replace it with a Trailing Stop when a Take Profit is reached.

For example: EURUSD, 5 min candle, when a new candle is created, I'm going Long (buy) with a 10 pip StopLoss and 20 pip Take Profit. When the price reached the Take Profit I don't want to close the position but, instead, cancel the StopLoss order and place a Trailing Stop from the Take Profit level.

With numbers: 5 min candle open at 1.2050, I Buy at that price, StopLoss 1.2040, Take Profit 1.2070. Price reached 1.2070, StopLoss cancelled, new Trailing Stop from 1.2070 with a 5 pip gap, so if the price drop at 1.2069 the position closes, if it goes up to 1.2076 I have the new stop set by the trailing at 1.2071 (at 1.2077 it will be 1.2072, etc..)

Does anyone can help me?

Thanks in advance

Enrico

Basic Principles - Trading Operations - MetaTrader 5
Basic Principles - Trading Operations - MetaTrader 5
  • www.metatrader5.com
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
 
Enrico Fasani:

For an EA that I'm developing, I would like to cancel the StopLoss and replace it with a Trailing Stop when a Take Profit is reached.

Does anyone can help me?
  1. A Trailing Stop is a moving StopLoss. You don't want to cancel anything. When the Take Profit is reached, the order is closed. You don't want a TP, you have an initial target.
  2. Help you with what? You haven't stated a problem. Show us your attempt (using SRC) and state the nature of your problem.
              No free help
              urgent help.