Artificial Neural Network Pro
The Expert Advisor trades the signals from an artificial neural network. Network with one hidden layer. Presence of a signal is checked at the closing of the specified period, which significantly increases the optimization and testing speed. It differs from the previous version by a number of additional features:
- works with pending orders;
- subsequent trades are opened with a lot increased by the specified step;
- moves the trade to breakeven a specified time after it was opened;
- closes trades at the specified loss or profit set by different parameters;
- testing results are saved to a text file for further analysis.
The Expert Advisor settings:
- Pending order offset (>0 limit-order, <0 stop-order) - type of the opened order. If it is greater than 0, the buylimit or selllimit orders will be opened. If it is less than 0, the buystop or sellstop orders will be opened, depending on the signal from the neural network. If the parameter is equal to 0, the EA will open market buy or sell orders;
- Take profit - take profit value;
- Stop loss - stop loss value;
- Start trailing if profit > (pips) - trail the stop loss order if the profit exceeds the specified value; 0 - trailing disabled;
- Lot size - volume of the opened position. During testing, it is increased in proportion to the change in the balance;
- Lot step for same direction next deal - increase the volume of the next position in the same direction;
- Timeframe - chart period. Presence of a signal is checked at the closing of the bar of the specified period.
- Trade direction - allowed trading direction: buy, sell or buy&sell;
- Do not trade if spread> - prohibit trading if the current spread is greater than specified;
- Close deal by - deal closing method: at an opposite signal; RSI cross of the level specified levels and with a reverse;
- close buy at RSI % - close a buy trade when the RSI crosses this level from above, with reverse - from below;
- close sell at RSI % - close a sell trade when the RSI crosses this level from below, with reverse - from above;
- a1 ... a8 - input parameters of the neural network (weight coefficients of the values for the RSI oscillator), used for training it on history, values from 0 to 100;
- Signal Force (%) - strength of the neural network signal, in % (values from 20 to 80);
- RSI period - period for averaging the values of the RSI oscillator;
- RSI shift - shift of the RSI oscillator values, greater than or equal to zero;
- Scan for signal after days from last deal - open a trade in the same direction by signal if the specified number of days has passed since the last trade opening;
- Amount of arrows in signals - open a trade if there is a specified number of signal confirmations on previous bars;
- ...in bars - the number of previous bars;
- Minimum distance to the same direction deal - minimum allowed difference in points between deals in the same direction;
- Set breakeven after bars - move a trade to breakeven a specified time after it was opened. The time is defined by the number of bars of the traded period;
- Close deals with losses - close losing trades if there is a reverse signal, yes/no. If "no", a take profit of the previous losing trade is moved to the trade's open level (breakeven) when an opposite signal appears. If the previous trade is profitable, it is closed;
- ...maximum deals with losses - maximum allowed number of floating losing trades. Trades are opened by signals till the limit is reached;
- Close deals if total loss > (%) - close all open trades if their loss exceeds the specified value;
- Close deals if total profit > (%) - close all open trades if their profit exceeds the specified value; <80/86/95% >
- Close couple deals by breakeven - close unidirectional trades by breakeven (yes/no);
- Slippage (in pips) - allowed slippage when opening a trade;
- Magic number - magic number of trades;
- Write this string as order's comment - write this string in the order comment;
- Write backtest results into .csv file - write the testing results (drawdown, volume of the open positions, maximum position holding time, etc) to a file. The file is located in the MT4 directory, in \tester\files.
Training the neural network (selection of parameters а1 ... а8) was performed for the EURUSD on the history interval of September 1 - November 1, 2016, М30, Open prices, closing with losses. Results of testing in the interval of September 1 - January 22, 2017 are shown in the screenshots.
2. Fixed a bug in the function of closing orders at the intersection of the RSI levels.
3. The default parameters work well on AUDJPY, M30, open prices. They also work well on NZDCAD, but with a different value of Minimum distance = 1000 (for five digits).
2. Added the weekday filter when the EA cannot open new trades - Do not trade at days of week. The values are from 0 to 6, where 0 is Sunday, 1 is Monday, etc. Weekdays can be set in a single list.
2. Added manual setting of the RSI indicator levels for closing deals.
3. Added parameter that sets the minimum allowed difference in points between deals in the same direction.