Trabajo finalizado
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Tarea técnica
SCOPE OF WORK
Create an EA designed to execute trades on a single currency (EURUSD) or Index (US30) rather than a basket of instruments. It should be designed to execute trades on a single chart at a time or on multiple charts by changing the Magic Number. The EA should be designed to run 24-hours/day, 5-days/week, unattended. The EA will run on my dedicated VPS at BestFXVps in New York City. My ECN Broker is ICMarkets and their Server is also located in New York City. All charts will initially be M5.
Entry signals are based on (4) indicators, source code provided, and (1) time condition. Only (1) active order at a time. Exits are by the SL, TP, and/or by a reverse signal. Option should be made available for a trailing stop.
A long position is opened with a Market Order on the Open of the next candle if on the Close of the current candle the below conditions are present simultaneously:
Time =>StartTime and Time =<EndTime
Candle is Green (Close>Open)
Indicator #1 dot color has changed from Red to Blue
Indicator #2 has crossed over as indicated by ShowMe UP Blue arrow
BollingerBand (UpperBand – LowerBand) => input value in pips
Conditions on the current (uncompleted) candle are ignored, only completed candles at their Close are analyzed. A chart showing several trades follows.
----------------------------------------------------------------------------------------------------------
MONEY MANAGEMENT
The order Lot Size is calculated as shown below where:
Balance - $10,000.00 current account balance in USD;
Lot% - 25% an input parameter (the % of the Balance to use for the trade);
Leverage – 200 an input parameter;
Current chart price – 1.17971 (EURUSD).
Lots = ((Balance x Lot% x Leverage) / Current chart price) / 10,000,000
((10,000 x 25 x 200) / 1.17971) / 10,000,000) = 4.23833 Lots to trade
The calculated result must be rounded to 2-decimal places for Currencies = 4.24-lots
For Indexes the calculated result must be truncated to integers = 4.0-lots
StopLoss (SL) and TakeProfit (TP) - are initially fixed and are adjustable by the parameters StopLoss and TakeProfit. The levels are specified in points of 5-digits for Currencies and 2-digits for Indexes. The levels are calculated relative to the price of the opened position (the Ask price - for the long positions and the Bid price - for short positions). If the value is too low, the stop should be set at a minimum allowed distance. If 0 values specified, the stops are not used.
----------------------------------------------------------------------------------------------------------
If selected, the open position is accompanied by a trailing stop by the iTrailingLine indicator (all indicator parameters should be adjustable):
If a long-position is opened, and the indicator line is below the current price, the stop is moved to the level of the indicator line;
If a short position is opened, and the indicator line is above the current price, the stop is moved to the level of the indicator line;
The indicator values are taken from the completed (formed) bar, the current bar (uncompleted) is not used. That is, the modification should occur no more frequently than once in a bar;
Moving the SL is permitted only in the direction of profit of the position - up for long position and down for short position;
If you can not set the SL at the level of the line, it should be set at the minimum allowable distance (but only if it complied with the previous rule of moving in the direction of the profit);
The trailing stop feature should be configurable (AllowTrailing = true/false parameter).
----------------------------------------------------------------------------------------------------------
If there is an opened position, and there is a opposite signal, the opened position must be closed and a new one must be opened (in the opposite direction). For a new position the calculation of the lot must be called after closing the opened position.
-----------------------------------------------------------------------------------------------------------Miscellaneous:
When you run the Expert Advisor, it should attach the used indicators with the specified parameters;
The information on the opening/closing of positions and of modifications of the SL should be stored in the Journal;
If there are any errors, it must print a message describing the error.
The following is a discussion of the EA entrys plus other conditions but first some comments about the lines on my chart. The vertical Green line is the Open of the NYSE. The 2 vertical Grey dashed lines are 12:00 and 1:00 EST representing the Lunch hour in New York City. The 2 horizontal Red lines are Yesterday’s High and Yesterday’s Close. All of these lines are to be ignored by the EA.
Area around the #1 – I use the distance between the Bollinger UpperBand and LowerBand to indicate price volitility and the bands are too close together here to place any trades.
Up arrow near the #2 – No long trade can be taken here because the candle color is Red and the MA lines are also Red.
Down arrow at #3 – A short entry can be taken here because all the indicators are Red.
Up arrow near the #4 – A long entry can be taken here because all the indicators are Blue.
Other requirements:
(1) - Specify programmed actions for power loss, internet connection loss or Broker connection loss.
(2) - No orders to be opened before StartTime and any Open orders to be Closed at EndTime.
(3) - The EA must allow for manual interventions such as a new manually placed order or to manually close an existing order.
(4) - Use ForexFactory or an equivalent News Service so that any Open Orders are closed 10-minutes before any HIGH Impact Economic Report release time AND no new orders can be placed 10-minutes after any such report. This must include the monthly FOMC Report.
(5) - Provide the source text (code) upon completion of the last working stage along with extended comments in the source text plus the error correction warranty period.