
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
What a pain in the ass... Check how you are counting.
GOLD at metaquotes (margin percentage - 1, leverage -300), CFD
On crosses and locked positions the calculations are also wrong, but personally I don't care, and I see that your script just doesn't handle it... I don't think it's worth the effort, if all the difficulties so far are in any case related to calculation of margin percentage and collateral for at least one CFD order.
p.s. I also start to think that it's no coincidence that the developers didn't give direct access to margin percentage :D
Can you share your experience how to open a demo on MetaQuote-Demo with a leverage of 300? I have a maximum of 100...
GOLD on MetaQuote-Demo
Printout
Screenshots
Can you share your experience how to open a demo on MetaQuote-Demo with a leverage of 300? I have a maximum of 100...
oops... Got confused in terminals with these tests. This one was insta, otherwise correct, GOLD, margin percentage - 1, leverage 300, screenshots above...
sorry!
The margin percentage is not a calculated deposit. It is just one of the components for calculating the margin. The result of this calculation (according to formulas in the table) returns in the margin currency, which must then (if it is different from the deposit currency) be converted into the deposit currency.
And that's something I can't quite put my finger on either. For example, we take a formula:
Where, Lots - this is the lot in the base currency of the instrument and the contract - also in the base currency, and then, if necessary, multiply the base currency to the quoted currency by the exchange rate. And with all this the result is obtained in the margin currency. How so?
And that's something I can't quite put my finger on either. For example, we take a formula:
Where, Lots - this is the lot in the base currency of the instrument and the contract - also in the base currency, and then, if necessary, multiply the base currency to the quoted currency by the exchange rate. And with all this the result is obtained in the margin currency. How come?
This formula
is valid for the calculation of the margin for USD*** currencies
First, we determine which price we need to translate into the currency of the deposit.
If the instrument name starts with the deposit currency, in this case USD, then the price is not taken into consideration
If the order is OP_BUY, we need the Bid price
If the order is OP_SELL then Ask
I hope I have explained things clearly...
I hope I've made myself clear...
Um... I think we're talking about different things again. I just decided to try to clarify not the method of margin calculation (not the calculations), but how it turns out that at the output of margin calculation formula, where we practically do not work with margin currency, we get the result exactly in the margin currency. At least that's how I understood it fromir0407 message. And that's why I gave the simplest calculation formula, where there is no quotes accounting yet...
For the rest (the gut feeling method), I also tried it all, but noted that a single solution has not yet been found. I mixed up the brokers, but the results-no, i.e. on insta your last option with the above parameters, still produces cosmic numbers as well: https://www.mql5.com/ru/forum/193833/page8#comment_5243991
p.s. But thanks for the comments! Anyway I understand the way of thinking, the calculations described by you)
Erm... I think we're talking about different things again. I just decided to try to clarify not the method of margin calculation (not the calculations), but how it is that the output of margin calculation formula, where we practically do not work with margin currency, we get the result in the currency of margin. At least that's how I understood it fromir0407 message. And that's why I gave the simplest calculation formula, where there is no quotes accounting yet...
For the rest (the gut feeling method), I also tried it all, but noted that a single solution has not yet been found. I mixed up the brokers, but the results-no, i.e. on insta your last option with the above parameters, still produces cosmic numbers as well: https://www.mql5.com/ru/forum/193833/page8#comment_5243991
p.s. But thanks for the comments! Anyway, I understand the way of thinking, the calculations you described)
I do not even want to open a demo on insta. If it is not difficult, in the debugger can show what intermediate values are obtained. As on my screenshot
I don't even want to open a demo on insta. If you don't mind, in the debugger you can show what intermediate values you get. Like on my screenshot
Again, my bad luck! Apparently when parsing your code, I must have changed something in it (I forgot to return it) and that's why it threw up such an error. Now (just in case) re-copied the original - correctly and on insta counts. I'll test it with other brokers then.
Hats off to you, you almost got it right! At all three brokers previously reviewed with different margin percentages, the calculation for gold (for orders in one direction) is correct.
But the script still fails with exotics. I have stopped at fxcm broker. The percentage margin for gold is 70000, for conventional currency pairs is 130, the currency of margin seems to be USD. And nothing is counting correctly anywhere! (. I myself have been looking for the key to it for two days, and in fact as a result of this I am now looking for an answer to the question, how come that as a result of calculations of base currencies and their rates with quotes currencies, we get a margin currency... Maybe it's this, or maybe it's the fact that this broker takes into account the percentage of margin even for normal currency pairs.
Here you can download the terminal ru.files.fm/u/xfezz883#_ , unzip it, run it using the exe file, make a demo...
Hats off to you, you almost got it right! At all three brokers previously reviewed with different margin percentages, the calculation for gold (for orders in one direction) is correct.
But the script still fails with exotics. I have stopped at fxcm broker. The percentage margin for gold is 70000, for conventional currency pairs is 130, the currency of margin seems to be USD. And nothing is counting correctly anywhere! (. I myself have been looking for the key to it for two days, and in fact as a result of this I am now looking for an answer to the question, how come that as a result of calculations of base currencies and their rates with quotes currencies, we get margin currency... Maybe it's this, or maybe it's the fact that this broker takes into account the percentage of margin even for normal currency pairs.
You can download terminal here ru.files.fm/u/xfezz883#_ , unzip it, run it using the exe file, start the demo...
It is not a problem to calculate the crosses. You just need to take a quote, that translates from margin currency to deposit currency.
For example EURJPY price
If your deposit is in USD, you should use EURUSD. If you calculate CADJPY, you should use USDCAD. Here we should see how to add the deposit currency to the margin currency, we shouldn't just enter it in the list.
The counter ones are not so difficult having MarketInfo(symbol, MODE_MARGINHEDGED). The only problem is to find counter currency first, and then to decompose part of it by counter currency, and the rest by full...
In general, I see the only benefit of this article is that the trader knows in advance what margin will be taken when the pending order is activated and can delete the pending order if it is not enough in time to avoid errors. I once struggled with this when placing an EA in the market.