The EA allows creating a trading system based on a custom indicator. The trading robot automatically opens/closes trades by signals of the indicator that places the values not equal to 0 and EMPTY_VALUE to the buffer. The EA checks the values of the specified indicator buffers, as well as opens/closes and tracks deals according to specified parameters.
The trading robot features the following deal-tracking functions:
- setting stop loss and take profit by specified parameters or indicator data;
- calculating order volume by specified risk per deal;
- moving to breakeven (moving stop loss to the level providing the minimum profit value when the price passes the specified value);
- partial position closing (closing the specified volume part when the price passes the specified value);
- increasing a deal volume after receiving a loss;
- closing all orders by a total profit value.
The EA verifies sufficiency of free funds before opening a new deal, manages TP and SL levels, and checks order execution modes. The settings contain parameters for working on accounts with 4-digit quotes. For accounts with 5-digit quotes, the values are re-calculated automatically.
To implement your own indicator, enter its name (file name with no extension or path) and set applied buffers. The indicator should be compiled and placed in the standard application folder.
The EA resources already have a test indicator allowing you to check the performance in the strategy tester. To use it, enter the following value for the IndicatorName parameter ::Indicators\\TestIndicator.ex4 (default setting).
- startLot - initial volume when setting a fixed value;
- maxLot - maximum deal volume when calculating by risk or multiplying;
- MaxRisk - maximum risk per deal (define order volume by maximum loss in % of the deposit), does not work in case of zero stopLoss, cancels startLot usage, 0 - not used;
- Martin_factor - multiplication factor of a new order volume after a loss (0 - not used);
- stepProfit - profit step in points for partial deal closing (0 - not used);
- stepProfit_factor - volume in case of partial order closing (0 - not used);
- stopLoss - stop loss in points (0 - not used);
- takeProfit - take profit in points (0 - not used);
- noLoss - level for moving to breakeven in points (0 - not used);
- noLoss_factor - level for moving to breakeven in fractions of SL (0 - not used);
- trailStop - trailing in points (0 - not used);
- trailStep - trailing step in points (0 - not used);
- DualOrders - allow opening sell orders when active buy deals are present and vice versa;
- UseAllSignals - allow orders by all signals;
- ProfitNum - minimum number of orders for closing by total profit;
- ProfitSumm - profit value to close orders;
- IndicatorName - indicator name (with no extension or path);
- openBuyBufferIndex - buffer for opening buy orders (-1 - not used);
- takeProfitBuyBufferIndex - buffer of take profit values for buy orders (-1 - not used);
- stopLossBuyBufferIndex - buffer of stop loss values for buy orders (-1 - not used);
- closeBuyBufferIndex - buffer for closing buy orders (-1 - not used);
- openSellBufferIndex - buffer for opening sell orders (-1 - not used);
- takeProfitSellBufferIndex - buffer of take profit values for sell orders (-1 - not used);
- stopLossSellBufferIndex - buffer of stop loss values for sell orders (-1 - not used);
- closeSellBufferIndex - buffer for closing sell orders (-1 - not used);
- BarIndex - bar index in a buffer;
- useMaFilter - enable MA based filtering of signals;
- MaFilterTimeFreme - timeframe of the Moving Average;
- MaFilterPeriod - period of the Moving Average;
- MaFilterMethot - method of the Moving Average;
- MaFilterPrice - prices of the Moving Average;
- CustomEventBuy - custom buy event (0 - not used)
- CustomEventSell - custom sell event (0 - not used)
- timeStart - trading start hour (0 .. 23);
- timeEnd - trading end hour (0 .. 23);
- slippage - slippage in points;
- MAGIC - identifier;
- useMail - enable sending email messages;
- useNotification - enable sending push-notifications;
- messageText - message text;
- TesterAutoTradeWeek - enable weekly automatic buy signal in the strategy tester.
Here you can find an example of creating a system based on a simple custom indicator (in Russian).
Added the TesterAutoTradeWeek parameter for the automatic validation of the EA on mql5. In testing mode, the EA automatically generates buy events 1 time per week.
-useMaFilter - enable MA based filtering of signals;
-MaFilterTimeFrafe - timeframe of the Moving Average;
-MaFilterPeriod - period of the Moving Average;
-MaFilterMethod - method of the Moving Average;
-MaFilterPrice - prices of the Moving Average.
- Added email and mobile notifications