Trabalho concluído
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Termos de Referência
Hi,
I have the following EA (pls see attached mq4 file) which I require some slight modifications to it. Please retain the structure of the current EA as much as possible.
Here are the required changes
1) Currently, the EA requires user to specify the price levels to buy/sell. Please modify the code to enable EA to automatically determine the appropriate prices to place the pending limit orders based on the following rules :
i) Take the price at the close of the latest candle ("Closing Price") (This can be on any timeframe for any currency pair)
Buy orders :
a) Place 1st level buy limit order at the Closing Price - [50] pips and round down to the nearest 25 pip level. The distance from the Closing Price should be a user defined input with 50 pips as the default.
b) Place 2nd level buy limit order 25 pips below the 1st level buy limit order and so on.
The EA already has input fields for users to key in the appropriate gap (in pips) for each limit order ("Gap") up to 6 levels and the common stop loss ("SL") for the batch of orders. Please retain this structure.
To illustrate, if Closing Price of EURUSD is 1.0860, 1st level buy limit order is derived by 1.0860 - 50 pips = 1.0810 pips & rounding down to the nearest 25 pip level. Hence, 1st level buy limit order shall be @ 1.0800. The entry prices for buy limit orders at other levels shall be computed from the price of this 1st level limit order and the relevant user-defined Gaps. There shall be a single SL for this entire batch of orders while the profit target shall be determined by the user input TP levels. The EA automatically cancels all higher level pending orders once the TP is hit. There should be no change to this methodology.
Sell orders
a) Place 1st level sell limit order at the Closing Price + [50] pips and round up to the nearest 25 pip level (i.e. 1.0800, 1.0825, 1.0850, 1.0875, 1.0900 etc.). The distance from the Closing Price should be a user defined input with 50 pips as the default.
b) Place 2nd level buy limit order 25 pips above the 1st level buy limit order and so on.
To illustrate, if Closing Price of EURUSD is 1.0860, 1st level sell limit order is derived by 1.0860 + 50 pips = 1.0910 pips & rounding up to the nearest 25 pip interval. Hence, 1st level sell limit order shall be 1.0925. The entry prices for sell limit orders at other levels shall be computed from the price of this 1st level limit order and the relevant user-defined Gaps. There shall be a single SL for this entire batch of orders while the profit target shall be determined by the user input TP levels. The EA automatically cancels all higher level pending orders once the TP is hit. There should be no change to this methodology.
2) The EA currently has the function to close all unfilled orders by a certain time. Please retain this structure but allow for the user to input the appropriate server times the EA is allowed to trade. If user does not key in any Trade start time/ Trade End time, the EA shall cancel all pending orders at the close of the current candle and look for new trades based on the methodology described in (1).
For example, if the user enters Trade Start @ 2100 and Trade End @ 1000, then the EA should use the close of the 2100 candle as the basis to determine the prices of the pending orders. The EA should then close all unfilled pending orders by 1000 provided that there are no ongoing trades from the relevant batch. It should then start looking for new trades at the close of the 2100 candle.
There should be a separate field for user to close all unfilled orders by a certain time on Friday before the market closes.