| / | Forum |
|
bahmrockk
2008.06.12 17:31
Hi there, i am pretty new to coding in MQL4 and tried to create a test-EA to check some things up. (I have a huge amount of crapcode in between the interesting parts, which i will cut out - only the parts that have effect on the variables are posted :) ) extern int StopLossTolerance=10; double sar, ...; double oderStopLoss; sar = iSAR(NULL, 0, SarStep, SarMax, 5); orderStopLoss = OrderStopLoss(); [...] else if (orderStopLoss+orderStopLoss*Point < sar && sar+StopLossTolerance*Point < Ask) { ... So fine it looks okay to me. But when i put an OrderModify in there it got me an error code 1 (nothing changed). I started to wonder where the error could be, and after printing the whole inflicted variables, i got this result: Print ("-------"); 2008.06.12 15:17:56 2008.06.05 17:58 RSIPAREMA EURUSD,M1: ========= It now came to my mind that MQL perhaps uses more than four decimal places, which are just not shown when printed. Is that the fact or have i done something really stupid here? ^^ thanks in advance! - georg |
|
The Automated Trading Championship 2007 Is Over! 12 weeks of the most interesting, most exciting event in the world of automated trading - the Automated Trading Championship 2007 have passed. All Expert Advisors have been stopped. It's time to acclaim the Winners and hand them their prizes. |
|
ukt
2008.06.12 18:02
hi georg, please consider all workings with doubles in light of normalization and symbol pair. MarketInfo() is mind opening and strongly suggest if not done already - you forget coding for bit and read Programming in Algorithmic Language MQL4 and always note: great importance placed on NormalizeDouble() ========== for sure more than 4 dp's. dbl is 64bits after all, yes? Print(dbl); defaults to 4 dp's but not strictly true as Symbol() biased eg: 2008.06.12 14:50:17 testx EURJPY,H1: Symbol()=EURJPY, Bid=166.36, Ask=166.39 and quicky code is: int start() note also that mql conditionals are 100% guarranteed to be left -> right executed - no exceptions... there are reprecussions if any multipart condition has dependancies, yes? so gotta at times single-shot conditions into dreaded nested ifs syndrome...lol ===== friend - fwiw, mql has warts for sure but you be beyond hard pressed to find/discover some issue that stop code from doing what code. that is the crux here, code will do what you have put down. the outcome maybe not wanted but mql just do what it do cuz that how it works... even tho is royal pain in backside... ;) maybe help... enjoy trip! |