Работа завершена
Техническое задание
This system uses two indicators the built-in MT5 Trix calculated from 14 candles (the default for Trix) on a 5 minute time frame and a custom VWAP available here https://www.mql5.com/en/code/14484 I am only interested in the daily the final product does not need the monthly and weekly. Again it is on a 5-minute candle.
The conditions for opening a position The indicator buys (money management etc. explained below) and draws a buy arrow when on the previous candle (i.e. not the live one) the close candle price has risen above the Trix but is below the vwap line. The attached picture can clarify I have drawn an up arrow where this happens.
Money and order management.
I want to able to set an overall maximum percent of equity for a symbol a maximum number of positions for a logo and a percentage distance from existing positions within which the trade cannot be opened.
For example if I chose 50% of equity for the symbol 5 for the maximum number of postions and 10% for the distance from existing postions. If the EA opens a position priced at 100 it will take 50% of the equity divide that by the maximum number of positions 5, in this case, this will give the maximum cost of a position. The EA then will not open a position within 10% of the price of that or any other position i.e. it will only open another position when the price is above 110 or below 90 and if there are less than 5 positions open.
Closing positions.
First, there needs to 4 configurable date range that the EA will not close the position over.
Next, the EA needs to monitor all positions for a symbol and be able to check the combined profit of all positions in that symbol. The EA will place a trailing stop loss once a configurable percentage of the combined profit has been reached. The stop loss will trail a configurable percentage of the profit (to clarify if I set the configurable percentage of combined profit to 10% and the trailing stop loss to 90% then once a combined profit of 10% is made the trailing stop loss would be activated be on 90% of the total profit and would then trail any upward movement of the price and staying still for any downward movement of the price.). This trailing stop loss will move as the price goes up and stay in place if the price goes down closing the trade if that price is hit. If a new position is added, and this causes the combined profit of all trades on the symbol to go below the specified percentage of combined profit, the trailing stop loss will be removed. The trailing stop will also be removed if it is during the configurable date ranges. Once out of these dates it will only place the railing stop again if it still meets the previous criteria for placing a trailing stop. i.e if it is
Finally, I would like to be able to use the ea as either an expert advisor or indicator so I can choose between it just drawing open arrows and making and controlling the trade.
Looks
The Ea is required to draw the trix vwap and close price lines on the chart. Please take the attached picture as an example. Redline is the vwap green the price and blue the trix.
The EA and indicators will all work on a 5 minute time frame.
I will require the MQ5 file for future changes and tweaks.