The Expert Advisor opens a trade in the direction of the previous price movement or in the opposite direction (selectable). The previous direction is determined based on the chosen time interval. The interval can be set to trading session hours and thus to check the theory that the price is inactive after session close. Multiple trades can be open at a time depending on input parameters. The Expert Advisor trails the stop loss order, and is provided with multiple breakeven and trade closing functions (see description of the parameters).
The EA trades one-hour bars, so it should be optimized and tested using the open prices of H1 bars, which reduces the testing and optimization time. After testing, in the Journal window of the strategy tester, the EA adds the following monthly statistical information: profit percentage for the month, the number of traded lots and the floating drawdown (see the screenshot).
The EA can be controlled via a panel.
The EA performs virtual trading on history and displays the results on the chart. Whenever the EA parameters are modified, the results of virtual trading are changed on the control panel. The virtual trading is performed at the opening prices of hourly bars, without stop loss and take profit, with the trades closed by opposite signals.
- Lot size - volume of the opened position. During testing, the volume changes in proportion to the initial balance;
- Start hour - the beginning of the time interval, hour (0 to 23);
- End hour - the end of the time interval, hour (0 to 23);
- Maximum deals - maximum number of open deals at a time;
- Gap - the minimum price difference between the initial and final time (points);
- Use reverse - use reverse when setting trading direction;
- 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;
- Trade direction - allowed trading direction;
- Set breakeven after bars - move a trade to breakeven a specified time after it was opened;
- Set sl to breakeven if loss > (pips) – move the stop loss of a trade to breakeven if its loss exceeds the specified value;
- Set tp to breakeven if profit > (pips) - move the take profit of a trade to breakeven if its profit exceeds the specified value;
- Close all deals by breakeven - close all trades when breakeven is reached;
DEALS CLOSING – trade closing algorithm
- Close deals if total loss > (%) - close all open trades if their total loss exceeds the specified value;
- Close deals if total profit > (%) – the same for profit;
- Close deals by opposite signal – close a deal if an opposite signal emerges;
- Close losses - close or no not close (wait out losses) the unprofitable trades if there is a reverse signal;
- Close deals after opening (in hours) – close a deal after certain time in hours;
GRAPHIC PARAMETERS – visualization parameters for additional information
- Show deals results – show the trade results on the chart;
- Show signals (last days) – show the signals for the last days;
- Show cute panel – show the control panel;
- Show virtual trading results (for last months) – show the results of virtual trading for the last months. The results will show a date in the format of MM.YYYY, the total number of points earned and the profit factor, as the ratio between points earned and lost. The function works only in live trading mode, i.e. it does not work in the tester.
- Slippage (pips) - allowable slippage value;
- Magic number - magic number of trades;
- Write this string as a deal's comment - comment to trades.
2. Modified the logic of determining the price movement direction. Updated the set files.
2. During testing, it increases in proportion to the initial balance.
2. Added several functions (see the description of the parameters).