• Overview
  • Reviews
  • Comments (12)
  • What's new

MarketBot

This is a multicurrency Expert Adviser based on signals of CCFpExtraSuperMulti indicator. It buys currencies at the top of the indicator and sells currencies at the bottom. It allows choosing thresholds of the indicator's signals strength to enter the market and to exit it. You may optionally enlarge existing position if the signal strength increases by specified steps. Also, it is possible to add lots if the price keeps moving against the signal due to the market inertia. Conditional stop losses with trailing are supported. You may choose the market context as a cluster of preferred symbols, then trade by signals on any combination of the cluster currencies or only on selected work symbols.


Parameters

Trading system settings:

  • Instruments - a comma separated list of market symbols passed to underlying CCFpExtraSuperMulti indicator; by default, "EURUSD,GBPUSD,USDCHF,USDJPY,AUDUSD,USDCAD,NZDUSD", that is all Forex majors;
  • WorkInstruments - a comma separated list of work symbols, for example, "AUDJPY,AUDNZD" (without quotes, no spaces); these are symbols for trading; if the parameter is empty (as it is by default), all symbols available for any valid combination of currencies, mentioned in Instruments, will be used; as Instruments includes 8 major currencies by default, any symbol constructed by a pair of the currecies will be traded - 28 symbols in total; in the tester only current symbol is available, so leave this parameter empty or specify the current symbol - otherwise, there will be no trades at all;
  • GridPointsList - a comma separated list of grid steps used for corresponding work instruments, for example, "300,400" (5-digits); the number of values should be equal to the number of work instruments, so EA will use corresponding value for each symbol; as an alternative, one can specify values only for some of work instruments - in such case the syntax changes: "XXXYYY1=DDD1,XXXYYY2=DDD2", where XXXYYY is a symbol name and DDD is a value; work instruments, for which there is no corresponding value will use a value from the common GridPoints parameter; if the parameter is empty, a value from GridPoints is also used for all work instruments; each value is a distance between averaging orders (if averaging is enabled) and initial stop loss; default - empty;
  • GridPoints - default distance in points between orders for all work instruments which do not have specific settings; default - 400;
  • MA_Method - moving average method passed to the underlying indicator; default - 3 (linear-weighted);
  • Price - type of applied price for moving average passed to the underlying indicator; default - 6 (weighted);
  • DefaultBase - default common currency of the market instruments; it is used only if the base cannot be detected automatically; default - "USD";
  • Shift - bar number to take signals from; default - 1; use 1 for price types other than open; use 0 for open price type;
  • LevelLimit - a threshold (minimum) for signals to enter the market; this is a difference between 2 lines of the underlying indicator; default - 75; the threshold is checked in addition to the main condition that 2 currencies are located at the top and at the bottom of the indicator window (StrictModeEnter is true by default) - when this is true and the signal strength is equal to or larger than the specified value, new position is opened, if corresponding work instrument is specified in WorkInstruments parameter or this parameter is empty;
  • LevelStep - a value of increasing change in signal strength, after which an averaging order is placed; default - 10; for example, if a position was initially opened by signal 77, it can be increased at 87+ and 97+;
  • LevelExit - a threshold (maximum) for signals to exit the market; default - 0, which means that 2 lines of the underlying indicator should cross to generate the signal; if TrailStops is enabled, EA will set a stop loss at breakeven price level and trail it instead of closing existing position; StrictModeExit should be disabled;
  • StrictModeEnter - enable/disable a mode when a position is opened only when both currencies take topmost and lowermost locations in the indicator window; default - true; when it is false, signal strength above LevelLimit is enough to open;
  • StrictModeExit - enable/disable a mode when a position is closed if any of the two of its currencies leaves topmost or lowermost location in the indicator window; default - false.

Expert Library Settings:

  • MagicBase - custom magic number; default value - 0 meaning that a unique magic is generated for every EA instance (this is a matter of symbol and timeframe of current chart, so 2 instances placed on charts with the same symbol and timeframe will generate the same magic, beware); the generated magic is printed to the log.

Orders Parameters:

  • Lots - number of lots for new orders and increment for lots of averaging orders, when IncrementLots is true; default value - 0.01; when it's 0 - Risk takes effect;
  • Slippage - allowed slippage for requests (in points); default value - 10;
  • TrailStops - enable/disable stop loss trailing; default value - true;
  • TrailingStep - step (in points) for stop loss trailing; default value - 10;
  • TrailNonProfit - enable/disable stop loss trailing for orders with a profit less then StopLoss; when it is false (default value), the Expert Advisor waits when price goes StopLoss points from open price and only then starts trailing; when it is true, every price movement to favourable direction on next TrailingStep points will trigger trailing.

Algorithm Parameters:

  • BarByBar - enable/disable trading mode by bars (true) or by ticks (false); default value - true (recommended); please note, that stop loss trailing is always performed by ticks with TrailingStep accuracy even if BarByBar is enabled; BarByBar affects only new signals;
  • MultipleOrders - allow/disallow multiple orders for every work symbol; default value - true; when it is false, averaging is disabled; 

Money Management:

  • IncrementLots - enable/disable incrementing of lots of averaging orders; default value - false; it makes sense only when MultipleOrders is true;
  • MaximumLot - maximum lot allowed for a single order; default value - 0.5;
  • Risk - this parameter takes effect only if Lots is 0; it specifies a size of order lot as a percent of free margin ("FreeMargin" * Risk / "MarginRequiredFor1Lot"); default value - 0.01 (1%);


Instructions

Recommended timeframes - H1, H4 and D1. 

You can run backtests in MetaTrader 4 tester provided that history for all symbols specified in Instruments parameter is downloaded in addition to the history of the current symbol. 

Please note that you should test this EA in "open prices" mode only because MetaTrader 4 tester is NOT multicurrency: ticks are generated only for current symbol, but all other market instruments involved in calculations have OHLC prices only for every bar.

The EA can work on every tick but it is recommended to use the mode of processing on bar opening (set BarByBar to true).

On the screenshots below, results for some tests on selected symbols are presented using default settings (no optimization) and constant lot 0.01, timeframe - H1, dates - 2013.01.01-2014.07.25.

Test mode is "open prices", but the results are accurate because BarByBar parameter is true.

Figure 1 shows results for a single run on NZDUSD.

Total combined result for all tests is shown on Figure 2. MetaTrader 4 tester does not allow multicurrency testing, so this screenshot is produced by special external script from the tester reports "as is".

Every test performance is shown on Figure 3 for comparison (also generated by the external script).

On the next Figures 4-10, test results are presented for the cluster of tickers of Russian oil industry - #GAZP,#LKOH,#ROSN,#SIBN,#SNGS. Figures 4-8 demonstrate reports for each of the tickers, and Figures 9 and 10 are comparison of the balance lines and their combined balance line.

No reviews
Version 1.1 - 2014.08.15
- Fixed a bug affecting operations when the number of symbols is less than 7.
- Supports trading non-Forex symbols.