TheRealMorris:
If anybody has any ideas, I'd appreciate a hint. I've been looking at this for hours and can't find the problem (it's probably something stupid) but I'm stuck :-(
I am currently testing an EA which I have converted from MQL4 code to new MQL5 code. Things generally work but the lot size calculation (based on a fixed risk percentage) is off:
When my EA runs, I get this output:
However, when running in a Demo account against US30, the margin for the opened position (11 Lots) is 1240 EUR (approx 1400 USD).
The logic my function is using seems quite simple/basic and I'm not seeing where it would be going wrong. Could anybody give me a hint as to what's causing this problem/discrepancy?
Thanks a lot
TheRealMorris:
If anybody has any ideas, I'd appreciate a hint. I've been looking at this for hours and can't find the problem (it's probably something stupid) but I'm stuck :-(
Ideas about what? What did you expect?
If anybody has any ideas, I'd appreciate a hint. I've been looking at this for hours and can't find the problem (it's probably something stupid) but I'm stuck :-(
Code looks ok. Sounds like you're testing on two different accounts. Post some logs/screenshots.
lippmaje:
Code looks ok. Sounds like you're testing on two different accounts. Post some logs/screenshots.
Thanks for giving it a look. Following your suggestion, I tested this code on two other brokers and there it works fine. So it's something weird about my broker but I still have no idea what's causing it.
Code looks ok. Sounds like you're testing on two different accounts. Post some logs/screenshots.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am currently testing an EA which I have converted from MQL4 code to new MQL5 code. Things generally work but the lot size calculation (based on a fixed risk percentage) is off:
When my EA runs, I get this output:
However, when running in a Demo account against US30, the margin for the opened position (11 Lots) is 1240 EUR (approx 1400 USD).
The logic my function is using seems quite simple/basic and I'm not seeing where it would be going wrong. Could anybody give me a hint as to what's causing this problem/discrepancy?
Thanks a lot