# Coding an MT4 EA to take profits and adjust stop losses

This project requires to code an EA to determine a profit target points and adjust stop losses.

I have an EA that only enters a trade and sets a stop loss price. What is required from the programmer is to develop a complimentary EA that will set its profit targets and adjust stop losses based on some of my risk to reward ratio criteria.

More details of these will be provided by PM.

Further to the posting above, no stop losses adjustment is required. Only profit target determining points are required.

I will be providing an EA and you will see in the code that it adjusts stop losses by itself to break even at some point in time during the trade. You will insert the profit target codes inside this EA.

I will be sending out a detailed explanation of what is required to those who have placed bids in a few moments.

The trade entered as described above executes only ONE trade order but they will be required to be partially closed at 3 profit targets.

The profit targets will be determined by calculating the amount of risk (price entered minus stop loss price).

Trade example: Assuming a trade executes on the EURUSD with a risk of -20 pips (price entered minus stop loss).

1. The first profit target will have a risk reward ratio (RvR) of 1:1. The first profit target will be set at +20 pips. The trade will partially close when price hits +20 pips.

2. The second profit target will have a risk reward ratio (RvR) of 1:2. The second profit target will be set at +40 pips. The trade will partially close when price hits +40 pips.

3. The first profit target will have a risk reward ratio (RvR) of 1:3. The third profit target will be set at +60 pips. The trade will completely close when price hits +60 pips.

Further note: I will also need to have a customised field where I can input the size to close for the 1st, 2nd and 3rd TP. Assuming all my trades executed by the EA have a lot size of 0.03. Then, I want to have the flexibility to input 1st TP = 0.01 lot size, 2nd TP = 0.01 lot size and 3rd TP = 0.01 lot size. Or on separate trade, I may have a total lot size of 0.04. I may want to set my 1st TP = 0.02 lot size, 2nd TP = 0.01 lot size and 3rd TP = 0.01 lot size. In summary, I want to have the flexibility to input the amount of size to close at respective TPs.

See attachment for graphical illustration.

The EA attached to this description is a money management EA. Note that this EA does not open the trade. It moves stoploss to breakeven when the profit is greater than or equal to stoploss. This is the only part that modifies its stoploss. There are no other modification string that will modify or interfere with the trade. You will be required to add in codes into this EA to Take Profits. Therefore, the codes that you program must be able to read the price entered and stoploss of the trade. Due to circumstances, I cannot release the part of the EA that executes the trades.