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

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
@ Artyom Trishkin @ Vladimir Pastushak
Doesn't work in my case. I am not asking for a new post. I know it calculates and returns margin for one type of trade. But it is useless if a trade is already open and I want to know the margin consumed by one trade of a particular symbol.
Can you help me please? If you don't understand my situation, let me know.
Simple explanation of the scenario:
You see this field in ToolBox:
This is the margin for the symbols: AUDJPY, EURUSD and EURTRY.
I know I can get this value with AccountInfoDouble (ACCOUNT_MARGIN). But I can't get the value of a specific symbol. For example, I want to know how much margin EURUSD is consuming. That I can't perform any function. Hence, I want to know how I can calculate it.
I hope this explanation is enough to make sense.
@Vladimir Pastushak I will try it. But let me tell you, it's not a workable solution. The value given by OrderCalcMargin () changes each time. But the margin value doesn't change. If I close any trade, the margin value will be the same as it was when I opened the trade. But when I use OrderCalcMargin (), the value I get changes and is not at all like the original value.
Please let me know if you have also tried this on your side. I know it won't work. Nevertheless, I will use it as you insist.
I opened a trade with a lot size of 50 in EURUSD. See what I got after using your function:
See, the margin is constantly changing. But the value of a trade already opened does not change. Can you tell me what to do now?
I opened a trade with a lot size of 50 in EURUSD. See what I got after using your function:
See, the margin is constantly changing. But the value of a trade already opened does not change. Can you tell me what to do now?
I have tried the above code.
I got this:
But the expected value was this:
For other symbols, the margin value still changes. Hence, OrderCalcMargin () is not the solution. You got it. Try it on your side first, please.
For other symbols, the margin value still changes. Hence, OrderCalcMargin () is not the solution. You got it. Try it on your side first, please.
2 orders 5891 * 2 = 11782 If you need to process the array symbol by symbol... It's not a problem...
2 orders 5891 * 2 = 11782 If you need to process an array character by character... It's not a problem...
But I made only one trade on EURUSD. And the function doesn't work properly with other symbols.
Can you tell me if there is a hook for the mql5 indicator? To set two display properties.
And somehow bind different output, each to its own mapping property.
Can you tell me if there is a hook for the mql5 indicator? To set two display properties.
And somehow bind different output, each to its own mapping property.
There are no such hooks. Not on the right or on the left. Neither for MQL5, nor for MQL4.
Use your own constructions on the main chart from the subwindow.