Mt4 Programming Project

I would like to get a new EA developed. This would be based on the Martingale system. broad rules are as follows:

1) This EA will be used mainly to trade gold i.e. XAUUSD, 1 lot = 100 ozs
2) When the EA is activated, it should open by a buy trade and a sell trade at the market price.
3) If the market moves against any position by the number of pips which is the input, i.e. ‘grid size’ then the EA should open a 2nd trade for the quantity (calculated as previous trade lot size x ‘Multiplier’ (default value: 2.0). Let us assume that it moves further away than it should open 3rd trade at 0.4 lots and the 4th trade at 0.8 lots etc.
4) In the previous EA, we were getting take profit level at a fixed number of pips based only on the last trade in the cycle. In case the market gapped, this would result in a take profit level which would actually result in the entire cycle closing at a loss. Hence for this new EA, the take profit should be calculated based on the average price of all buy/sell trades.

Ive pasted one example of one cycle.
Here the grid size was 300 pips.
The 1st trade opened for 0.1 lots at 1230.12
The 2nd trade opened for 0.2 lots at 1233.15 (303 pips instead of 300 pips, this is a small diff so it is okay)
The 3rd trade opened for 0.4 lots at 1236.07 (292 pips instead of 300 pips, this is a small diff so it is okay)
The 4th trade opened for 0.8 lots at 1240.17 (410 pips instead of 300 pips, this is a big diff)

Please see the excel sheet attached.

Parameters for Settings

Initial lot size: Default 0.10 lots
Grid size: Default 300 pips
Take profit pips: default 325
Multiplier: 2 (this is the factor by which new trades are opened, i.e. first trade 0.1 lots, 2nd trade of 0.1 x 2 = 0.2 lots, 3rd trade of 0.2 lots x 2 = 0.4 lots and so on)
Max # of buy trades: level after which no more buy trades should be opened
Max # of sell trades: level after which no more sell trades should be opened
Buy TP level: if 0, then should be calculated by the EA, otherwise should set the TP for all buy orders at the level that is entered
Sell TP level: if 0, then should be calculated by the EA, otherwise should set the TP for all Sell orders at the level that is entered
Send Email: true/false (if true, send email as per the martingale EA email)

Any manual buy/sell trade entered in the same account for the same pair, i.e. XAUUSD should be controlled by the EA. Ie. It should take into account the lot size and the price for the manual deal and calculate it in the avg price, TP etc.

Leave a Reply

Your email address will not be published. Required fields are marked *