작업 종료됨
명시
I'm looking to have the following indicator programmed. The goal of the indicator ist to provide trailing stop levels for winning trades. A percentage of the winnings is given as breathing room to winning trades.
Indicator inputs:
(A) Trades to monitor: "Long" or "Short"
(B) Number of trades to monitor: #
(C) Start trailing at Pips: #
(D) Trailing percentage: 1-99
(E) Magic number: #
Indicator behaviour:
1) Get starting point:
- The indicator looks for open long or short trades, depending on input A.
- If there is 1 open trade, the tade open price is used as starting point.
- If there are multiple open trades, the indicator calculates the combined starting point from the trade open prices and the respective lot sizes of the number of trades specified in input B. This means a basket of multiple orders can be treated as one position.
- If Input E is "0", all open trades on the currency pair are used. Otherwise only trades with the specified magic number are used.
2) Wait for trades to go into profit:
- As long as the monitored trades are less than the number of pips specified in input C in profit (or in loss), the indicator displays nothing.
3) Show trailing stop line:
- As soon as the monitored trades are more than the pips specified in input C in profit, the indicator displays a line as follows.
- Locked in pips are calculated: Distance from starting point to furthest reached point of profit in pips / 100 * input D = locked in pips.
- The line is drawn at starting point + (for long trades) / - (for short trades) locked in pips.
- As price retraces back into less profit or even loss the line does not move. It only moves towards more profit.
Please see also the attached graphics that demonstrate the princliple for inputs A=short, B=1, C=15, D=50, E=0.
Note: I will require an indicator in mq5-Format and with easily readable buffers to be used by another EA.