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
In general, for a textbook it would be better to write in brackets:
All operators of the form @=, where doggy means the symbol of any operation, are always executed over the right operand, fully counted before the operation is executed. This is covered in Part 2, under Modification Operations.
The margin calculation file is described in part six, where it is assumed that the previous parts have been mastered. The complexity increases towards the end of the book - I don't argue with that, so I tried to make references to the big concepts and principles from past sections from the following sections, where these were used as building blocks (to refresh your memory), but not for such small things.
...The complexity increases towards the end of the book - no argument with that, so for the big concepts and principles from past sections, I tried to make references from the following sections where it was used as building blocks (to refresh my memory), but not for such small things.
Stanislav, I have a more modest level in programming unlike yours. I try to write code so that it is easier to check it in the Debugger. That's why I don't often use the ternary operator. And if I do, I use it with parentheses... There are such skilful people who write several ternary operators included in each other. This is something close to the macro programming style of my colleague fxsaber. Probably every approach has a right to life. And it is already a matter of taste...
Great respect and respect for the tutorial! Some interesting things are described in more detail than in the Documentation.
It is of little use anyway, because in the end it still counts the margin incorrectly if the volume is more than three.
Margin calculation for ten contracts.
Please attach the script for checking. Now I have run it on the whole market overview - it coincides with the standard function regardless of the volume.
And the compiler's pissed off:
Probably something changed in the compiler. At the time of the book's release, all sources compiled without warnings or errors, except in cases where there were deliberate irregularities for demonstration purposes.
I try to write code so that it would be easier to check it in the Debugger. That's why I don't often use the ternary operator. And if I do, I use it with parentheses....
I agree. I stick to this rule too, except for simple cases - but here everyone has his own barrier of simplicity. Readability of the code is treated individually, usually we look for a "golden mean" between the approach "all in one line" and "each token on a separate line". With brackets - similarly. Software companies usually have a set of rules on source code layout - in this case there was none.
Please attach the script for verification. Now I have run it on the whole market overview - it coincides with the standard function regardless of the volume.
Oh, man. I can't believe I didn't see that message. Oh, man.
Actually, nothing has changed for me.
Metaquot server, terminal version 4420.
The code is like this
The result is this.
Someone is counting wrong.
I may have got rid of namespace MPM incorrectly. I don't know what it is and why it is needed, but it didn't let me compile the EA.
Actually, I just removed the namespace MPM line , curly braces after it and renamed OrderCalcMargin, added the underscore.
In general, the file compiled in this form. Is it possible that this is the error?
The code is as follows
The result is like this
Someone's counting wrong.
Here is found in the news for the beginning of 2024 (i.e. after the writing of the book) about build 4150 - https://www.metatrader5.com/en/releasenotes/terminal/2342.
In the server settings and symbol specification interface they added the margin dependence on volume.
I have not found how to get to these properties from MQL5.
In a particular broker/instrument this floating margin setting may not be activated, so I did not see any differences when checking not on MQ demo.
Added volume margin dependency to the server settings and the symbol specification interface.
I have not found how to get to these properties from MQL5.
@Renat Fatkhullin
Are there any plans to add the ability to get these properties from MQL5 ?
Forum on trading, automated trading systems and testing trading strategies
Expert Advisors: MQL5 Programming for Traders - source codes from the book. Part 7
Stanislav Korotky, 2024.11.23 20:26
Here I found in the news for the beginning of 2024 (i.e. after the book was written) about build 4150 - https://www.metatrader5.com/en/releasenotes/terminal/2342.
In server settings and symbol specification interface they added margin dependency on volume.
I have not found how to get to these properties from MQL5.
In a particular broker/instrument this floating margin setting may not be activated, so I did not see any differences when checking not on MQ demo.