U
You have the error number - you need nothing else :)
See https://docs.mql4.com/constants/errors
Seems you have something wrong with the value/s for stoploss or takeprofit
Use the Print statement for these values and look for the Print output in the Journal
HTH
-BB-
U
You have the error number - you need nothing else :)
See https://docs.mql4.com/constants/errors
Seems you have something wrong with the value/s for stoploss or takeprofit
Use the Print statement for these values and look for the Print output in the Journal
HTH
-BB-
I know what the error number means, but I want the ErrorDescription function to work properly for me.
U
Implication is that the ErrorDescription function cant take a function to deliver the parameter
Try catching the int value first
int check; check=GetLastError(); if(check!=ERR_NO_ERROR) Print("Cannot trade, error: ",ErrorDescription(check));
and let us know
TIA
-BB-
Thanks BarrowBoy for your help. It seems to work, now I'm happy :)
Implication is that the ErrorDescription function cant take a function to deliver the parameter
not really... string ErrorDescription(int error_code) is just a string function with big switch(error_code) in it and the actual can be any value which resolves to type int.
See the file ErrorDescription.mqh in your ...\experts\include directory. <ctrl+d> in editor shows mql navigator.
Builtin GetLastError() is a once only destructive memory access Client Terminal operation.
for example:
first call of GetLastError() after a trading function returns an error code because your last OrderSend() returns -1 due to some failure - which prompts you into making call to pickup the error code...
Specifically:
int GetLastError( | ) |
In other words:
BB's code for 'grabbing' a copy of the error code is a necessity IF your code requires access to this last error code more than once...
btw,
your best bet is to always read the help including the links on each help page and please not forget the great mql4 book too!is confusing at times but would in this issue, have saved your mind meltdown... :o)
Thanks ukt :)
was a bit slow there - should have known it was a volatile value.
Its the same in SQL Server for @@ERROR and goodness knows I've done enough of that...!
-BB-
BB, no biggie - I'm a paranoid docs reader...! Trouble is mt docs imho leave so much to desire...
(must be why in this new century I've lost most hair - thanks mt - LOL )
BB - if here, Why say Alpari not 4 ur code?
I only demo+live on Alpari. Something I should know?
ukt
Dont think I did - certainly didnt mean to - they actually have relatively EA friendly data feed and do micro accounts :)
Its just that I already have live & demo data from them - need data on brokers apart from FXCM, Alpari, MIG
-BB-
Thank you for your thorough explanation, ukt. It should have come to my mind.
BB - fair enough but from below maybe you can see why I thought to ask...
"If you have a live & demo MT account on a broker other than Alpari, MIG or FXCM and want to..."
U - well, BB said it all really - I just mentioned the read once gunk. MT can be massive heart attack maker - guess is why I always drone on about the docs (spread over so many diff places of course! - Seems MT is just reinforcing the "I've got ya by the short 'n curlies and not gonna let you go YET... still gotta suffer some more!"
I keep a picture in my mind of MT giving me some GBH (that way I can generate a smile during those frustrating times :)
:o))
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Everytime I use ErrorDescription function like here below I receive "Error: ERR_NO no error" message. Instead of error description I get stupid "no error" text. No matter what error number is, always the same "no error" text. What am I doing wrong? Anyone could help?