
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
Tests show that when the margin percentage is equal to 1, leverage is not taken into account! But when it is 100 and above, it is already taken into account. I wish I could find a broker with a margin percentage between 2 and 99 inclusive.
Something is wrong. Leverage is used when you calculate this percentage from the margin on 1 standard lot, and leverage is taken into account there.
Compile this script and if there are open orders run it on any pair.
I only have 2 orders open, it shows correctly for them.Something is wrong. Leverage is used when you count that percentage from the margin on 1 standard lot, and leverage is taken into account there.
Compile this script and if there are open orders run it on any pair.
I have only 2 orders open, it shows correctly.I have done it. At present time the market is closed in demo mode and only orders on gold are open. My words are confirmed by insta (margin percentage:1) your script shows some kind of space...
I don't know what to do with it, but I have to correctly calculate the percentage of margin in metaquotes and robot, where the margin percentage is 100 and 200.
Open a demo account with 5 quid and a leverage of 100 and see what the margin percentage will be, for example, the same for gold or even funnier - the ruble...
Done. Now on my demos while the market is closed only on gold orders are open. My words are confirmed by insta (margin percentage:1) your script shows some kind of space... so doesSYMBOL_CURRENCY_MARGIN
MetaQuotes and RoboQuotes where the margin percentage is 100 and 200, everything is correct.
I do not understand what it shows wrong. I opened 2 more orders for oil where the margin percentage = 1 and the contract size is only 1000 and not 100,000 as for currencies.
This is what is printed
Here is a screenshot
For some reason, it shows the exact penny.
So, apart from words, put pictures...
So in addition to words, post pictures...
Somewhere like this (lot 0.05, leverage 300):
Somewhere like this (lot 0.05, leverage 300):
I see. Pay attention to the currency of the margin. Mine is XAU and yours is USD and then you have to do something with this line
so that the quote is included in the calculation. Maybe add a path to the symbol.
And for the double check change this line like this
But in this case it won't work correctly for currencies.
In general, we should consider all variants of path to the symbol and all variants of margin currencies for the universality.
I see. Pay attention to the currency of the margin. Mine is XAU and yours is USD and then you have to do something with this line
so that the quote is included in the calculation. Maybe you should add a path to the symbol.
To check it again, change this line like this
All the same, it is not correct, the order is the same, the result is the same:
Generally, all variants of path to the symbol and margin currency should be taken into account for the sake of universality.
I see the margin currency, but what path variants to the symbol are we talking about?
p.s. The formula without leverage counts everything accurately:
Still wrong, same order, same result:
Margin currency is clear, but which paths to the instrument are we talking about?
p.s. According to the formula without leverage everything is calculated accurately:
Yeah, I messed up a bit... The lot size is not considered at all. It's shown correctly because my orders are of 1 standard lot... I should add this line
The path to the symbol is defined as follows
but alas, there is no unambiguous naming, so it's not so easy to set the condition.
Robo, the ecn demo has such a path,
and on a cent.
Others may be similar, but not unambiguous. Of course we can compare with substring, but to be sure of universality we should check many brokerage companies.
Although... you could try to check for the way the collateral is calculated.
I will check it now.
Yeah, I messed up a bit... The lot size is not taken into account at all. I'm getting it right because the orders are 1 standard lot each... I should add this line.
I did, but the result is still wrong)
The path to the symbol is defined as follows
What a pain in the ass... Check how it counts for you.
I made this one to count pending orders as well, but it doesn't include the total margin.