Tuesday, April 28, 2009

MT4 EA: Stupid Programming Mistakes

Well, I spent last evening tracking down some problems in my next foray into programming expert advisers.

It turns our that a simple logical test was using an '&' instead of an '&&' between two terms.

This little horseshoe nail caused some position closing attempts to fail with an error 138 -- meaning that the price being used to close the position was too far away from the market price.

I also ran into the example code for iHighest() again. The example shows it implemented with High[iHighest()] when you generally may want iHigh(...,...iHighest()) instead.

In all, I find programming in MT4 a bit frustrating. Sure, sure, hard core programmers may blame me for being imperfect, but it's time programmers realized that humans are imperfect. I know -- I program for a living.

No comments: