Simple assertion module for MQL4.
- Download Assert.mqh
- Save the file to /MQL4/Include/mql4_modules/Assert/Assert.mqh
- Define IS_ASSERT
- Include Assert.mqh
#define IS_ASSERT
#include <mql4_modules/Assert/Assert.mqh>
double sample(double lots, double price) {
assert(lots > 0, "invalid parameter lots");
...
...
}
In this case, if lots less than zero or equales zero, displays message.
Note: You need define IS_ASSERT before include assert.mqh.