Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 891

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- 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
But you don't take into account differently directed orders and the Margin hedge factor here.
The "order direction" is accounted for byAccountFreeMarginCheck https://docs.mql4.com/ru/account/accountfreemargincheck
For your purpose, my function needs to pass the total lot and order type OP_BUY or OP_SELL as parameters
If it is a counter-close, the margin is released there,
For a lock there was something similar, but I don't think all brokers use the same way of calculating margin for a lock, I don't remember, the lock theme seems to have subsided in runet, it's not in demand
for the coefficient it seems to be about the leverage, there were discussion threads, search through the forum "margin calculation" should be able to find it, I have not dealt with this topic for a long time, it is not in high demand
here is an article on the subject, it seems to have a margin calculationhttps://www.mql5.com/ru/articles/2555
The "direction of the order" is accounted for byAccountFreeMarginCheck https://docs.mql4.com/ru/account/accountfreemargincheck
For your purpose, my function needs to pass the total lot and order type OP_BUY or OP_SELL as parameters
If we are talking about a counter-close, the margin is released there,
I don't remember, the topic of locks seems to have subsided in runet, it is not in demand.
for the coefficient it seems to be about the leverage, there were discussion threads, search through the forum "margin calculation" should be able to find it, I have not dealt with this topic for a long time, it is not in high demand
here is an article on the subject, it seems there is a margin calculationhttps://www.mql5.com/ru/articles/2555
AccountFreeMarginCheck assumes this is the current price. My price is not the current price. It's different.
SYMBOL_MARGIN_HEDGED no analogue for MT4?
MarketInfo(_Symbol, MODE_MARGINHEDGED);
Thank you. What about this? Is it possible to calculate what I need? Margin for the orders to be opened in advance, knowing their price and volume.
Please advise why the program does not show any changes and does not show oil and raw material stocks
Thank you. What about this? Is it possible to calculate what I need? The margin for the orders to be opened in advance, knowing their price and volume.
I think if you can predict the price of the assets involved in the value of margin, the orders that are to be opened, you will not be costly. You don't need to trade forex, you can just tell the whole society for money what the price will be in xx minutes.
Probably it is better to calculate how much money you will need to open an order in the current moment.
You said it... But I'm not going to change it on principle. I'm just drunk. I'm not going to change it.
Anyway, for the reason already said, I can't understand the sabb itself. Maybe I'll figure it out tomorrow. But at any rate, the margin for pending orders is IMPOSSIBLE.
One more thing: at the moment of opening an order, margin is fully calculated and only after it has been opened, will it be corrected according to MODE_MARGINHEDGED.
Accordingly, if you need to calculate a deal to lock up a losing position, you should count as an opening with a 100% margin and only after that open an additional order with the released funds.
If I got it wrong... sorry...
The most important thing is the RIGHT one.
Yes thank you it's not convenient to put those zeros in the print.
One more remark: At the moment of order opening, margin is calculated in full and only after opening margin is corrected in accordance with MODE_MARGINHEDGED.
Accordingly, if you need to calculate the trade size to lock up a losing position, you should consider it as an opening with a 100% margin and only after that open an additional order with the released funds.
If I got it wrong... sorry...
I do not really understand this comment. You can open a locking position (opposite to the one opened) if your margin is lower than the margin for the newly opened order (not in the position itself). So where is 100% there?