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
Well, the problem is that margin_initial=0.0 for all the symbols while they have different one
I will give a short snippet from my code, just to help you understand, it does not compile, nor is it complete....
Well, the problem is that margin_initial=0.0 for all the symbols while they have different one
Margin Initial is only used for following calculation modes:
Margin maintanance is also 0 for all of them so I cant take your code and work on it, the only thing is order_calc_margin function but I have no idea how to use it
So why are you still using values, that are not applicable, obviously?
You need to apply some brains to the code I posted. - You are looking for margin_rate, as can be seen by my code.
Is it so, that nobody here understands the code, I've posted? - Or is it in fact you need spoon feeding the solution?
It is very hard to determin, if someone is simply not applying their brains, or are in fact not capable of reading the code.... - How am I supposed to tell the difference?
EDIT:
BTW, margin_maintenance in my code is a boolean operator, which determines, if you are querying for maintenance margin or for current margin rate...
Maybe you should first get familliar with margin and how it works, as it seems, lots of people have trouble with understanding how it works. But, if anyone is serious about their foregoing in trading, this should be basics, that need to be understood. - Thats almost like if you cannot read or write, but want to be an author... - Then first learn how to read and write, I would suggest, at least.
Sry but i dont think I am advanced in programming. Is a hobby and I have little experience with complex things.
I have tryied your example and it give the right leverage only for one symbol of 5 tested and only if I devide the result bu 100
Forum on trading, automated trading systems and testing trading strategies
Leverage for each symbol
Rafael Sierra Clemente, 2021.10.31 19:48
I've calculated symbol leverage in this way:
I have tried this code modified for python but it also give wrong values for a lot of symbols for example it gives 500 for symbols with 100 and everybody say is the tick value wrong. Now I presume I modified right. like I use ordin_calc_margin for margin value
Sry but i dont think I am advanced in programming. Is a hobby and I have little experience with complex things.
I have tryied your example and it give the right leverage only for one symbol of 5 tested and only if I devide the result bu 100
I have tried this code modified for python but it also give wrong values for a lot of symbols for example it gives 500 for symbols with 100 and everybody say is the tick value wrong. Now I presume I modified right. like I use ordin_calc_margin for margin value
As a closing state to this issue:
Some brokers have such complex margin rules in place, it is not possible to get all relevant and needed data from the symbol specifications to reliable determine the margin requirements for each symbol and traded volume.
In this case, the broker has a tier-list, depending on the volume, your leverage will decrease and on top, they have an increased margin requirement at the closing hour of a trading session. - But all these details are only available on their webpage and are different for different asset classes, so it would require to either hard-code these details and have them be in code, or build some config file where these values and parameters could be stored and edited.
Whatever the solution seems to be concerning this issue, it might be advisable to simply use the MQL-provided function to calculate the required margin in this case.