The Expert Advisor receives signals from an artificial neural network that uses the RSI indicator. Trades are closed by the opposite signals. Presence of a signal is checked at the closing of the bar. The EA also has the following functions:
- changing a position volume in proportion to the change in balance (function for the tester);
- transfer of unprofitable trades into breakeven;
- Start with lot - initial position volume increased in proportion to the balance change;
- Lotsize by balance - increase the lot size in proportion to the change in balance (yes/no). Use only in the tester;
- Timeframe - chart timeframe, presence of a signal is checked at closure of a bar with the specified period;
- a1 ... a8 - inputs for the neural network, values from 0 to 100;
- a9 - strength of the neural network signal, in % (values from 20 to 80). The higher the value, the less the trades;
- a10 - averaging period of the RSI indicator;
- Close losses - close losing trades (yes/no). If "no", a take profit of the previous losing trade is moved to a trade 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 opposite signals till the limit is reached;
- Slippage (in pips) - allowed slippage when opening a trade;
- Magic number - magic number of trades.
Training and testing
The neural network has been trained (selection of parameters а1 ... а9) on EURUSD from 1 September to 1 November, 2016, every tick, М30, allowing closure of losing trades.
Backtested on the same interval, but losing trades were moved to breakeven (see. screenshot).
2. Added one input parameter responsible for the averaging period of the RSI indicator.
3. Added the ability to disable scaling the position volume when the balance changes.