Работа завершена
Техническое задание
Hello,
I'd like to create a grid/basket EA based on moving averages.
All buy orders should act as one basket/group. All sell orders should act as a separate basket/group.
======
Here is the logic for opening new baskets/groups:
Open a buy order group - At the start of a new candle if the 6 period EMA is above the 21 period EMA the EA should place one market buy order.
Open a sell order group - At the start of a new candle if the 6 period EMA is below the 21 period EMA the EA should place one market sell order.
There should only ever be one buy order group and one sell order group. For example if our conditions are met to open a new buy order group, but there are previous buy orders still open the EA should not open a new order. The EA should only ever add orders to the buy/sell order groups when it is following the grid rules.
It is ok to have both one buy and one sell order group open at the same time. For example we have one buy order group open. The 6EMA crosses below the 21 period EMA, the EA should open a sell order at the start of the next candle.
======
There should be two options to close orders/groups.
Option 1: Take profit = when all orders combined = the take profit pips input all orders should close (typical grid/martingale system)
Option 2: Drawdown reduction mode = when drawdown reached a specific %, the EA will close only the oldest and the newest orders. For example we have 5 buy orders open. When order 1 and 5 reaches a specific profit (let's say $1) it will close just order 1 and 5 leaving 2, 3, 4 open. The EA will then work to close 2 & 4 once profit reaches $1 for those two combined orders. If there is an odd number of orders, the last order will also close when it reaches the minimum profit ($1 in this example).
======
Here are the EA input settings:
==General==
Order Type: both / buy only / sell only / none
Use Hedge: yes / no (if yes the EA will allow for both buy and sell order baskets. If no, the EA will only have one basket open - either buy or sell. It will not open an opposite basket, even when the conditions are met)
Start Lot Size: opening order lot size
Use Money Management: true/false
Money Management Risk %: (calculation for opening lot size if MM is set to true)
Lot Multiplier: the amount to multiply the lot size for orders in the grid
==Grid Settings==
Grid Step: distance between orders in the grid
Grid Step Multipler: multiplier for the grid order distance
TP: take profit for both the first order or the entire grid
SL: stop loss from the first order (example if 200pips is entered, all trades in the grid will be closed once the first order is -200 pips)
==Reduce Downdraw Settings==
Enable DD Reduction: yes / no (if no, TP settings from above will always be used)
DD Percentage Enable: The account drawdown percentage required in order to enable the reduction closing method (as described above)
Profit For Close: the profit needed between the oldest and newest order for the EA to close them
==Other Settings==
Magic Number
Start - End Hour For Trading
Maximum Lot
Maximum Spread