Need help squashing a bug

 

Hello,

I have no idea what is wrong with this piece of code bellow:

   bool Remainder = (MathMod(LotSize, MarketInfo(Symbol(),MODE_LOTSTEP)) > 0);  ///bug here
        if(Remainder||
           LotSize > MarketInfo(Symbol(),MODE_MAXLOT) || 
                LotSize < MarketInfo(Symbol(),MODE_MINLOT) || 
                Slippage < 1 || 
                Expiration < 0   )
        {   
                Proceed = false;
                Alert(Symbol() + Period() + "m: Please check input; EA will halt now. Remainder = " + Remainder);
        }
        else
                Alert(Symbol() + Period() + "m: Input is valid; proceeding...");

Remainder is being set to 1 for all positive LotSize values. I thought it would be set to 1 only when LotSize is not a multiple of the lot step (0.01). I can't figure out why it's not doing that. MathMod() works exactly the same way as fmod in C. I checked.

It would be great if some one could explain what is going on.

 
BenLinus:

Hello,

I have no idea what is wrong with this piece of code bellow:

Remainder is being set to 1 for all positive LotSize values. I thought it would be set to 1 only when LotSize is not a multiple of the lot step (0.01). I can't figure out why it's not doing that. MathMod() works exactly the same way as fmod in C. I checked.

It would be great if some one could explain what is going on.

MathMod() is broken . . . https://www.mql5.com/en/forum/143605
 

That is profoundly disappointing of mql4. I had no idea. Can't one expect the language to provide at least correct built-in functions? I spent at least 2 hours attempting to debug.

 

It would be nice to have a single pager of any know language bugs by function ...

When I started out with mq4 I spent ages only to find it was a bug in ArrayCopyRates ( https://www.mql5.com/en/forum/145761 ).

And it wasnt the usual 'call once in init/multi-threaded' issue, but to do with subtraction of the datetime values failing even if there is just a single EA(or script).

Otherwise the tendency is to spend a few hours debugging (rightly assuming that its most likely a programming error) before then searching the forums...

 
BenLinus:


That is profoundly disappointing of mql4. I had no idea. Can't one ne would expect that a language would provide at least correct built-in functions? I spent at least 2 hours attempting to debug.

I gets worse . . .

https://www.mql5.com/en/forum/143997/page2#773665

https://www.mql5.com/en/forum/143892/page3#784172 still no reply 4 months later.

 
ydrol:

It would be nice to have a single pager of any know language bugs by function ...

There are other issues, some simple poor translations, for example iBarshift() the Russian translated back to English by Google is better than the standard English documentation, what is going to be done with the major changes that are going on with the common MetaEditor ? will the documentation have proper change control and change history so we can all see what it has changed from and to ?
 
RaptorUK:
There are other issues, some simple poor translations, for example iBarshift() the Russian translated back to English by Google is better than the standard English documentation, what is going to be done with the major changes that are going on with the common MetaEditor ? will the documentation have proper change control and change history so we can all see what it has changed from and to ?


MetaEditor is a not a good IDE. I keep forgetting to look for other IDEs that work with mql4.
 
There is an IDE posted at another well known mq4 forum (3rd 'real' link if you google 'mq4 ide' ), I use Vim with some customisations, however the IDE makes no difference to the underlying bugs.
 
ydrol:
There is an IDE posted at another well known mq4 forum (3rd 'real' link if you google 'mq4 ide' ), I use Vim with some customisations, however the IDE makes no difference to the underlying bugs.


Vim! that is interesting. Tell me, how is that working out for you? I've had some experience with Vim before -- probably just editing configuration files.
 
BenLinus:

MetaEditor is a not a good IDE. I keep forgetting to look for other IDEs that work with mql4.
I'm not talking about ME, I'm talking about this: Documentation
 
BenLinus:


Vim! that is interesting. Tell me, how is that working out for you? I've had some experience with Vim before -- probably just editing configuration files.

Veering OT a bit, but it's your thread I guess :)

If you are already used to using Vi/Vim for development then I'd recommend setting up the extensions for Quckfix mode (jump to compile errors) and colour highlighting, if you have only dabbled then I probably would say look at something else!

Reason: