Errors, bugs, questions - page 2020
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
The OrderCalcMargin function does not take the opening price into account when calculating margin
Is this a Bug or should it be?
Of course it's a bug. Write to the SD.
This line works as it should, but I had to check as I have to guess the order of execution. Discussion on this point here.
A bug, of course. Write in the SD.
This line works as it should, but I had to check as I have to guess the order of execution. Discussion of this point here.
The order of calculating expressions in Print() is from right to left. Sort of... So far... Also checked it beforehand :)
It's hard to be sure when there is adirect contradiction in MQL4/5 reference:
MQL5 ReferenceLanguage FundamentalsFunctionsParameter Passing
Note
Remember that parameters are passed to the function backwards, i.e., the last parameter is calculated and passed first, then the penultimate one, and so on. The parameter that is the first after the opening bracket is calculated and passed to the function last.
MQL5 ReferenceLanguage FundamentalsOperations and ExpressionsOther Operations
Function call with arguments x1, x2,..., xn
Each argument can be a constant, a variable or an expression of a corresponding type. Passed arguments are separated by commas and must be enclosed in parentheses, the opening parenthesis must follow the function name.
The value of the expression is the value returned by the function. If the return value type of a function is void, the function call cannot be placed to the right of the assignment operation. Note that the order of expressions x1,..., xn is guaranteed.
So far I'm focusing on passing parameters in reverse order.
A question about OrderCalcMargin came up in a neighbouring threadhttps://www.mql5.com/ru/forum/216697/page3
Test: let's check 2 different ways of calculating the deposit by substituting different opening prices.
Here is the LOG
The OrderCalcMargin function doesn't consider the opening price when calculating the margin
This seems to be related to the exchange rate of the quoted currency, which has to be recalculated for the time and opening price.
If the quoted currency is USD (and the account currency is also USD), then the calculated margin will change according to the opening price.
Log for GBPUSD
Is it a Bug or should it be?
Probably it should be, because AUDUSD and USDJPY in particular are involved in the calculation, and their quotes are constant at the time of calculation.
Now, this thought makes me want to check... In the MetaQuotes-Demo account in the market overview GBPUSD is present, but not in the robo account...
This must be the case because AUDUSD and USDJPY in particular are involved in the calculation and their quotes are unchanged at the time of calculation.
Now, this thought makes me want to check... GBPUSD is present in MetaQuotes-Demo account, but not in Robo-account...
Just wanted to tell you - that there is a bug.
I have already reproduced your situation with Margin=0 in OrderCalcMargin calculation.
Just haven't posted it yet.
In MetaQuotes-Demo account GBPUSD is present in Market Watch, but not in Robo account...
Most likely present in Market Watch (not to be confused with the general list of symbols), but not shown.
This must be the case because AUDUSD and USDJPY in particular are involved in the calculation and their quotes are unchanged at the time of calculation.
Now, this thought makes me want to check... In the MetaQuotes-Demo account in the market overview GBPUSD is present but not in the robo account...
Here is the test:
1. Select crosses in MarketWatch, hide everything with USD
2) Add DSHBTC symbol and open its chart.
3. Close terminal
4) Open the terminal
5. Let's start test for DSHBTC
Here is the LOG:
All crosses show margin=0 and NO CROSS MAJORS have been selected.
Once again, run the script on DSHBTC
LOG
There are no major components, but USDJPY is the only one.
All tests were done on MetaQuotes
Most likely present in the Market Watch (not to be confused with the general symbol list), but not shown.
We are somehow talking about the same thing in different ways
We are somehow talking about the same thing in different ways
Exactly. The Market Watch doesn't show it, but it is there.
Fix it.
Done!
P.S. Forgot to remove the reserve :)