The Expert Advisor is based on the channel indicator Price_Extreme_Indicator.
The strategy is simple:
Positions are opened on each new bar if the above conditions are met. If a buy signal emerges and there are open sell positions, such positions will be closed and a buy position will be opened. The opposite is true for sell signals.
The Expert Advisor allows enabling/disabling long/short trades as well as reversing indicator signals to open sell instead of buy and vice versa. 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.
If the lot value is invalid, the EA will adjust it to a proper value. 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.
Note that for a proper operation, the EA needs the compiled indicator file Price_Extreme_Indicator. Also note that the Expert Advisor is designed for training and strategy testing purposes.
The EA has 11 configurable parameters:
To check the strategy, testing with default settings was performed using data in the interval from 2017.01.02 to 2018.01.19. Unfortunately, in this mode (trading the channel breakout) the Expert Advisor loses the deposit at the very beginning of the testing period. Then testing was performed with reversing signals. The following results were obtained:
Period M5, testing interval: 2017.01.02 - 2018.01.19
All parameters are set to default except for the reverse (Reverse trade == "Yes")
The testing graph shows that the EA is highly dependent on the market state (trend/flat). In this test, the EA traded inward from the channel borders. Stable profitable/losing areas are clearly visible. When trading inside the channel, the EA makes profit in flat zones. But as soon as the trend begins, trading inside the channel becomes unprofitable. So the strategy can be further developed: the EA should trade inside the channel during flat period and it should trade the channel breakout in trend direction during trend periods.
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/19818
The indicator shows the price increment of eight symbols in one window.Dynamic channel of one trading day
The indicator draws a channel of a trading day in the form of a cloud.