Forex Blog

First-hand Forex trading experience and information about foreign exchange market that will be useful to traders

Archives

Random Expert Advisor for MT5

May 2, 2010 (Last updated on May 21, 2010) by

My experimental randomly trading expert advisor myRandom is now available for download to be used in the MetaTrader 5 platform. It’s the 4th EA that was converted by me from MT4 to MT5 and it’s slightly different from its initial version. The main difference came from the fact that the MT4 version sometimes used hedging — when there was a buy position and the next random number suggested a sell position, it would open second position instead of just closing the previous position. In MT5 version of myRandom, buy and sell orders compensate each other resulting in only one position open simultaneously with a variable size and direction. The stop-loss and take-profit-levels now are applied only to this single position. This difference could have been eliminated with some complex virtual order system, but the objective of this random EA is to demonstrate the trading with randomness and such complexity would be unneeded here. This is also the first of my MT5 EAs that uses the standard Trade.mqh library (bundled with MQL5 Editor). It makes the order sending/closing simpler and can be quite useful to all MQL5 developers. Some other differences of the new version:

  • Better code structure.
  • More helpful error messaging.
  • Description for MT5 added.
  • Proper use of data types.

You can get the code of MT5 version or read more info about the expert advisor.

If you find some bugs in this MT5 EA or want to make a suggestion regarding its functionality or what should be my next MT4->MT5 conversion, please, use the commentary form below.

Leave a Reply

required
required (will not be published)