Specifiche
I am looking for an expert advisor that manages open positions on my MT4 platform (Broker Details: FXCM; 5 Digits account; 30:1 leverage; Instruments: FX & CFDs) that are manually openend.
Logic: If average profit from all open positions in FX-Pair/CFD-contract is more than X-amount in pips/points, then close x-% of all open positions
Example:
1. If the average profit from all open positions in EURUSD is:
a. more than 10 pips/points, then close 33% of all open positions
b. more than 20 pips/points, then close 33% of all open positions
c. more than 30 pips/points, then close 33% of all open positions
2. If there are for example 5 positions open at the moment the first profit target is reached, the EA should close 2 positions (so round up because it is not possible to close 1,66 (5*33%) positions). If the second profit target is reached (and there were no new positions created in the meantime) the EA should close 1 position ((5-2)*33% = 1)
3. While the EA is running in the background, the programm always has to monitor the change in open positions. So in case new positions are manually openend or closed the EA has to recalculate its next operations.
a. Example from above: If the Second profit target was reached and there were new positions entered in the meantime, the EA should start with the initial configuation, so that if the „new“ average profit from all open positions in EURUSD is:
i. more than 10 pips/points, then close 33% of all open positions
ii. more than 20 pips/points, then close 33% of all open positions
iii. more than 30 pips/points, then close 33% of all open positions
4. The EA should either use the FIFO (First in First out) or LIFO (Last in First out) principle, when closing positions
5. I would like to enter several closing instructions; i.e.:
a. 1) If the average profit then…
b. 2) If the average profit then…
c. 3) If the average profit…
d. …
ð If there needs to be a limit, than I would prefer 3 different closing instructions
6. Under some circumstances the EA also needs to be able to work with magic numbers, so that it only closes positions that were assigned a certain magic number (on/off function).