Hello everyone ! I use the following code for break-even trades. This works perfectly (for example: when I have 5 pips profit on the EUR/USD my stop loss change from -10 pips change to +1 pip so I can’t lose anymore on this position:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
startBreakeven=5//how much pips/points in gain to activate the breakeven function?
PointsToKeep=1//how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
//reset the breakevenLevel when no trade are on market
IFNOTONMARKETTHEN
breakevenLevel=0
ENDIF
//test if the price have moved favourably of "startBreakeven" points already
//place the new stop orders on market at breakevenLevel
IFbreakevenLevel>0THEN
EXITSHORTATbreakevenLevelSTOP
ENDIF
I searched this forum but can’t find anything about it. Does anyone know if it is possible to do something similar with a profit target ? For example my system opens a trade as follows:
Stop loss: 10 pips
Profit target: 10 pips
If I lose 5 pips (-5) in an open losing position then I want to move my profit target automatically from +10 pips to -1 pips. From here there are 2 scenarios:
You can use the same code reversing conditions, look for losses and as soon as you reach -startbreakeven you set breakeven to Tradeprice – PointsToKeep.