Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1250
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
I haven't looked into it - I can't tell you unfortunately.
I will explain. I hope it makes sense.
Here's the explanation:
I am trading EURUSD and AUDJPY in MT5. Both have margin booked as shown in the MT5 toolbar. I will share the image.
First trade on EURUSD:
I sold with lot = 1. Took margin = 235.31.
I am now trading on AUDJPY:
I sold at lot = 1. I took a margin call = 144.24.
And total margin shown in ToolBox = 379.55.
The toolbox, as you can see, shows the total margin used by EURUSD and AUDJPY symbols.
Now I come to my question.
I want to know what is the margin of the total margin used by EURUSD. I am not getting the calculations for this. I know that the answer should = 235.31
But with OrderCalcMargin () I get different answers. Sometimes the function returns 235.23, sometimes 235.01. But this is the wrong answer. I want to know how I can calculate the margin used for a particular symbol. In my example, tell me how I can calculate the margin used by EURSD or AUDJPY.
Note:
The answer OrderCalcMargin () sometimes gives the correct answer for EURUSD. But if I want to calculate the margin for AUDJPY, it is always different.
Now please let me know if I understand.
I have this question and have tried to explain it to everyone on the forum, but no one can understand. This is me trying again.
I'll try again if it still doesn't make sense.
@ Artyom Trishkin, let me know. I'm counting on you to give me a solution.
I will explain. I hope it makes sense.
Here's the explanation:
I am trading EURUSD and AUDJPY in MT5. Both have margin booked as shown in the MT5 toolbar. I will share the image.
First trade on EURUSD:
I sold with lot = 1. Took margin = 235.31.
I am now trading on AUDJPY:
I sold at lot = 1. I took a margin call = 144.24.
And total margin shown in ToolBox = 379.55.
The toolbox, as you can see, shows the total margin used by EURUSD and AUDJPY symbols.
Now I come to my question.
I want to know what is the margin of the total margin used by EURUSD. I am not getting the calculations for this. I know that the answer should = 235.31
But with OrderCalcMargin () I get different answers. Sometimes the function returns 235.23, sometimes 235.01. But this is the wrong answer. I want to know how I can calculate the margin used for a particular symbol. In my example, tell me how I can calculate the margin used by EURSD or AUDJPY.
Note:
The answer OrderCalcMargin () sometimes gives the correct answer for EURUSD. But if I want to calculate the margin for AUDJPY, it is always different.
Now please let me know if I understand.
I have this question and have tried to explain it to everyone on the forum, but no one can understand. This is me trying again.
I'll try again if it still doesn't make sense.
@ Artyom Trishkin, let me know. I'm counting on you to give me a solution.
Very important values to calculate in your case:
As an example, the AUDJPY and USDJPY are involved in the margin calculation. What was the AUDJPY exchange rate at the time you opened the position, no one will ever guess. You can only try to calculate via the current margin. This was mentioned in the thread I linked you to. But to be honest it doesn't say much about it, but there is something in the codes.
At each subsequent moment these rates change and hence you get different margin values. Calculate the ratio of the current margin to the opening price of the position and apply this coefficient in calculating the margin for the open position. You need to experiment. I do not remember the exact calculation algorithm.
But I don't think anyone will give you a ready-made solution.
Very important values for the calculation in your case:
As an example, the AUDJPY margin calculation involves AUDUSD and USDJPY. What was the AUDJPY exchange rate at the time you opened the position, no one will ever guess. You can only try to calculate via the current margin. This was mentioned in the thread I linked you to. But to be honest it doesn't say much about it, but there is something in the codes.
At each subsequent moment these rates change and hence you get different margin values. Calculate the ratio of the current margin to the opening price of the position and apply this coefficient in calculating the margin for the open position. You need to experiment. I do not remember the exact calculation algorithm.
But I don't think anyone will give you a ready-made solution.
Yes, I understand it. But I see that the MT5 ToolBox calculates exactly without changing the margin. Then what logic does the MT5 ToolBox use? Could you shed some light on this please?
Question how to assign a value to different variables via arguments in a function. If there is one argument, it can be returned and assigned a value, but if there are 2, what should be done?
Valery, maybe this will do:
Valery, maybe this will do:
Right, links, appersand if I'm not mistaken.
2020.09.09 15:18:33.572 TestS EURUSD,H1: x4= 6x5= 4
2020.09.09 15:18:33.572 TestS EURUSD,H1: x1= 3x2= 1
Thank you)))
Question how to assign a value to different variables via arguments in a function. If there is one argument, it can be returned and assigned a value, but if there are 2, what about this?
This is what?
void start()
Once upon a time, long, long ago. mammoths ate. And then they put it on. Is that what I think it is?
What's that?
Once upon a time... mammoths used to eat. And then they put it on. Is that what I think it is?
Don't judge, I wrote the script by hand. And a strict check skips old functions. Of course, I don't write my script that way. Besides, there are constructors. )))))
Corrected)