Specification
OVERVIEW
-
Trades are placed via another EA, will have a unique magic number, only 1 trade will be placed at a time per each magic number.
-
EA to initiate a martingale approach based on SL when trade becomes active (not whilst pending)
-
If martingale trades used (minimum 2 active trades) EA to manage with the aim to close out all open positions (on same magic number) to a TP level which returns a profit based on a percentage of balance.
-
If you no martingale used, then EA will move to break even based on a percentage of entry to TP level
-
EA to move the SL of all trades based on a maximum loss allowance based on a % value of account balance
-
EA will close any remaining orders once TP is hit
DETAILS
-
Trades are placed via another EA, will have a unique magic number, only 1 trade will be placed at a time per each magic number
I have another EA which will place the trades. The EA you will write will await for the initial trade to be placed.
-
EA to initiate a martingale approach based on SL when trade becomes active (not whilst pending)
Once a pending trade is placed, no action is to be taken. Once the trade becomes active, the EA will note the distance between the entry and SL levels. It will delete the SL and place a trade at that level, in the same direction as the initial trade.
Once this second trade becomes active, another trade will be placed, again in the same direction, and at the same pip distance as the entry to the initial SL level. This will continue in a martingale fashion, if that trade is then triggered for an entry then another trade will be placed at the same distance as the first entry to SL distance.
Each martingale trade placed after the initial trade will have a multiplier function, so it will increase the lot size based on this multiplier.
Example, x2 multiplier: Trade placed via external EA, 1 lot. This EA does nothing. Trade becomes active, the EA deletes the SL and places a pending order of 2 lots at that level, the EA notes the pip distance of 50 pips. This second trade also becomes active, a third trade is placed 50 pips away with a lot size of 4 lots.
-
If martingale trades used (minimum 2 active trades) EA to manage with the aim to close out all open positions (on same magic number) to a TP level which returns a profit based on a percentage of balance.
This is part of the MT4 EA which I have supplied. I have included the description I gave to the developer here:
The TP function will exit 2 or more trades with a % profit specified by the user. It will initiate, when 2 or more trades are active at the same time on the same chart. These 2+ trades will always be in the same direction. Eg 2 longs.
The moment a second trade (martingale) becomes active, the EA will immediately calculate the % profit return (specified within the parameters manually) and consequently move the TP to achieve this.
For example, I buy 1 lot and price moves lower and a second buy trade is initiated for 2 lots. I have specified that I want a 1% return from these two trades. Therefore, the EA determines what 1% profit is based on the current account balance. It then moves both of the take profits so that the combined win and loss returns that 1%. 1% may be $100, and therefore the first trade of 1 lot will return a loss of $20, and the second 2 lot trade will return a win of $120.
Similarly, if a third trade is initiated, then the EA wil again calculate the profit based on all of the active trades in the same direction, and move 3 TPs to the appropriate price level so 1% profit is returned.
I want the EA to also factor in swap and commission into the profit, so that I return a profit based on the account balance %.
-
If you no martingale used, then EA will move to break even based on a percentage of entry to TP level
This is also included in the MT4 EA.
There will be a move to BE function will only operate when 1 trade (the initial trade placed externally) is active. It will disable when a second (martingale) trade becomes active. It will be a percentage of the distance between the entry and TP levels. Eg. if it is set to 50% then the SL will be moved when price is half way (50%) between the entry price and the TP level. Amount of pips to move into profit will also be included.
-
EA to move the SL of all trades based on a maximum loss allowance based on a % value of account balance
In the same way the EA will manage the TP of each group of trades, the EA will also manage all of the SL so that there is a maximum loss based on the % of account balance. For example, the maximum loss is 10% of the account. The EA will move all of the SL (when 2 or more trades are active) so that the total loss of those trades equals 10% of the account balance.
-
EA will close any remaining orders once TP is hit
If the trades aren’t closed by SL loss, then they must either result in a win from the initial trade hitting its initial TP, or the martingale trades return a small profit. If either of these two things happen, then there will be a single pending order still open. Once TP is hit, the EA will delete the remaining pending order.