Articles

A Virtual Order Manager to track orders within the position-centric MetaTrader 5 environment for MetaTrader 5

This class library can be added to an MetaTrader 5 Expert Advisor to enable it to be written with an order-centric approach broadly similar to MetaTrader 4, in comparison to the position-based approach of MetaTrader 5. It does this by keeping track of virtual orders at the MetaTrader 5 client

Auto-Generated Documentation for MQL5 Code for MetaTrader 5

Most Java coders will be familiar with the auto-generated documentation that can be created with JavaDocs. The idea is to add comments into the code in a semi-structured way that can then be extracted into an easy to navigate help file. The C++ world also has a number of documentation

Forum

enum incorrect branch in switch

I have a bug in my code in which a switch statement branches to the wrong case for a user-defined enum. Here's the code which reports the incorrect enum. When m_LogLevel == LOG_VERBOSE (4), the function returns LOG_DEBUG. But unfortunately when I try to distill the problem down to a small example

Deals

I've played around with the the various Deal-related functions in MQL5 (HistoryDealSelect, HistoryDealsTotal, HistoryDealGetTicket, HistoryDealGetDouble, HistoryDealGetInteger, HistoryDealGetString) and I'm wondering if they apply at all to Forex? I can't find any scenario where HistoryDealsTotal()

Build 240 error - too complex program

New in build 240 is a "too complex program" error, see below #include <Arrays/ArrayObj.mqh> #include <ChartObjects/ChartObjectsLines.mqh> //+------------------------------------------------------------------+ //| |

Maximum string length read by FileReadString

Is there any reason for the 4093 character maximum length of a string read by FileReadString from a BIN file

Corrupted build 238?

On two totally separate envrionments (Windows 7 x64 and Windows Server 2003 x64) I can't load build 238. It just comes up with a garbled pop-up box for the compiler. Anyone else with the same problem

How to retrieve values from a CIndicator

I would like to use the classes derived from CIndicator (CiMA, CiStochastic etc) but have had no success. The code below always shows DBL_MAX #include <Indicators/trend.mqh> CiMA extMA; int OnInit() { extMA.Create( Symbol (), Period (), 10 , 0 , MODE_SMA , PRICE_CLOSE ); return ( 0 ); } void

Tree Optimize Error bug

The attached script produces a Tree Optimize Error with the code below uncommented int n=wa.Widget(0).m_Member; It appears that the compiler cannot handle the levels of indirection

Preventing decompilation of MQL5 executables

Could I get a comment please from MetaQuotes on what steps if any they have taken to make MQL5 difficult to decompile? As I understand it, the optimising MQL5 compiler delivers machine code, but even this may not be sufficient, see example of a mainstream .exe locker http://www.eziriz.com/

Problem with Windows 7

I'm running Windows 7 Ultimate 64 bit as administrator and there is a problem with writing or seeing MetaTrader 5 files: MetaEditor appears to compile OK but the resulting ex5 isn't visible anywhere If I duplicate one of the mt5 files then MetaEditor can't see it at all

Left/Right/Centre justification for chart text

Would like to be able to set the justification for OBJPROP_TEXT to left or right or centre. At the moment the only way that this can be done is to use the fixed spacing Courier New font and calculate padding