Join our fan page
TimeEA - expert for MetaTrader 5
- Views:
- 5582
- Rating:
- Published:
- 2018.03.01 11:54
- Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
A Simple Expert Advisor The EA opens a position of the specified type at the time specified in the EA parameters. The position is closed at the time specified in the appropriate parameter.
The purpose is to select the appropriate type of a position (either long or short) and to set position opening and closing time in hours and minutes. You can also set stop loss and take profit in points. If invalid Stop Loss and Take Profit values are specified, the EA will adjust the values to the minimum StopLevel allowed for the symbol.
The Expert Advisor will also adjust the lot in case an incorrect value is specified. If the lot is too large, the EA will adjust it in order to be able to open a position. If there is no money for opening even the minimum lot, the signal will be skipped.
The EA has a specific feature: if short stop orders are used and they trigger, a new position can be opened provided it is the same bar, on which the first position was opened at this time signal. In other words: if a position is opened at the current bar and is closed by the stop order, a new position will be opened if the new bar has not started yet, and so on until a new bar opens on the current timeframe.
The EA has 11 input parameters:
- Experts magic number - a unique identifier for the EA's positions;
- Hour of position open - hour in the position opening time;
- Minute of position open - minutes in the position opening time;
- Hour of position close - hour in the position closing time;
- Minute of position close - minutes in the position closing time;
- Position type - opening a long or a short position;
- Lots - the volume of position to open;
- Stop loss in points - Stop Loss value in points;
- Take profit in points - Take Profit value in points;
- Slippage of price - allowable slippage;
- Multiplier spread for stops - spread multiplier for calculating a correct distance for stop orders.
Two tests were performed in the Every Tick mode on EURUSD H1, using data in the interval from 2017.01.02 to 2018.01.19, in two modes: opening long positions and opening short positions. The EA showed good results in the Long Positions mode. This mode was additionally optimized in terms of position opening and closing hour.
The result of the EA testing with the opening hour set to 15 and closing hour set to 8, and default parameters is shown below:
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/19916
Implementation of multiple trailing types. Pending Buy Stop and Sell Stop orders. Limitation of the maximum total lot and the total number of positions. Several types of position volume calculation.
Percentage_Crossover_Channel_EAAn Expert Advisor, which trades in a channel based on the Percentage_Crossover_Channel indicator.
This non-trading Expert Advisor is designed for the simple trailing of take profit orders of open positions.
RndTradeOpening positions randomly after a certain time interval.