MetaTrader 4 MT4 Libraries ArrayVirtualOrders – library MetaTrader 4

ArrayVirtualOrders – library MetaTrader 4


Library for virtual trading.

It can be used for careful checking of the multicurrency strategies and for the expert parameters self-optimization.

The standard order processing functions Order*() has been replaced by v.Order*() functions.

The orders loading/unloading to/from the arrays is supported. So, it’s possible to save results of the virtual trade between some sessions. It also allows you to perform the virtual deals analysis with Excel.

The library uses the modified version of Igor Kim (aka KimIV) functions for orders processing. Also it uses an array of prefiltered orders, I don’t know exactly the author of this idea, I would like to thank him.

It calculates maximal drawdown and maximal profit during all period of the deal (unfortunelly, in points). Swaps is not supported.

As example of the library use, the simple script is included. It emulates some “random” trade with “random” instruments. The code is commented.


ArrayVO.mq4 -> experts\include\

Random.mq4 -> experts\scripts\

See results in experts\files folder.


07.12.09 added and modified

+ ArrayVO: Now OrderProfit calculates in the currency of the deposit.
ArrayVO: not established Expiration date for the order.
Random: at a chosen period of more than 5 days script thrown into an infinite loop.
+ Random: in the window displays the progress of the script – the “current” date, number of transactions.
+ Random: options stop loss and take-profit can now be defined as a percentage of the
instrument‘s price


Alternative:   wajdyss_SSL_channel_chart_alert_indicator_v2 - indicator MetaTrader 4

12.12.09 added and fixed (v1.03)
– ArrayVO: The algorithm of v.OrderSelect ()
function – if had been used ticket’s number, the pool parameter had been used too. Fixed related code sections.
+ ArrayVO:
added functions v.AccountBalance() and v.AccountEquity(). Calculation of values turn on by invoke CalcBalance (true), by default is off. To store these values was changed composition of the columns of arrays – using LoadArrays() for arrays, unloaded the previous version of the library, will lead to incorrect data. It is advisable to turn on the calculation of the test of an integrated strategy, and vice versa – for test patterns and the presence of multiple parallel open account orders better off (meaning in this calculation does not, and the rate of increase).


Editor’s remark:

Note that it’s a mirror translation of the original Russian version.

If you have any questions to the author, suggestions or comments, it’s better to post them there.

If you have found this code useful for trading or educational purposes, don’t forget to thank author.

📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks