Join our fan page
- Views:
- 5611
- Rating:
- Published:
- 2018.06.16 09:54
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
The EA uses indicator Small_Inside_Bar that searches and displays the "Inside Bar" Price Action pattern.
This indicator itself is not required for the EA operation, since its data are calculated inside the EA.
When the bullish "Inside Bar" pattern is found, the EA will open a buy position, while for the bearish pattern, it will open a sell position.
There are three options to open positions:
- A relevant position is opened at each signal, and the positions are closed by Stop Loss or Take Profit (*);
- A relevant position is opened at each signal, while the opposite positions are closed (refilled swing);
- A relevant position is opened at a signal, provided that such position does not exist, and the opposite position is closed (swing).
The EA allows disabling the buy/sell activities and has the reverse mode, i.e., a Sell position is opened at the buy signal, and vice versa.
The EA has twelve input parameters:
- Experts magic number - the unique identifier of the EA's positions;
- Mode of opening positions - position opening mode:
- Any position on each signal - any position at each signal (*);
- Positions on each signal in one direction (swing with a refill) - several position in one direction (refilled swing);
- Always one position (swing) - only one position always (swing).
- Long positions is enabled - opening long positions is enabled (Yes/No switch);
- Short positions is enabled - opening short positions is enabled (Yes/No switch);
- Reverse trade - transactions reverse mode (Yes/No switch);
- Lots - the volume of positions to open;
- Stop loss in points - Stop Loss value in points (0 means no SL);
- Take profit in points - Take Profit value in points (0 means no TP);
- Slippage of price - maximum allowable slippage when opening a position;
- Multiplier spread for stops - spread multiplier applied to calculating a proper distance for stop orders (*).
- Waiting for environment update (in seconds) - time in seconds to wait for the update of the trading environment (**);
- Number of attempts to get the state of the environment - the number of attempts to obtain accurate information on the trading environment (***).
To check the strategy, the default settings were tested using EURUSD H1 in the 1 minute OHLC mode within the interval from 2016.01.04 to 2018.03.29. Then, in order to find the best values of Stop Loss and Take Profit, the latter ones were optimized in the same mode and for the same time interval.
Optimal Stop Loss is 800 points, and optimal Take Profit is 900 points:
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/20497
![ChannelEA2](https://c.mql5.com/i/code/expert.png)
ChannelEA2 - an Expert Advisor working in a channel, using pending stop orders.
![Fast iBarShift and Bars for MT5](https://c.mql5.com/i/code/library.png)
Complete and fast functions similar to Bars and iBarShift from MQL4.
![N-_Candles_v7](https://c.mql5.com/i/code/expert.png)
The Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones. The account type is taken into consideration, i.e., whether it is a netting or a hedging one.
![Price Impulse](https://c.mql5.com/i/code/expert.png)
The EA waits for the price to pass XXX points within NNN ticks.