Questions from Beginners MQL5 MT5 MetaTrader 5 - page 741
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
You asked without perversions. And if you did, then...
{
double Commission = ::PositionGetDouble(POSITION_COMMISSION);
// На случай, если POSITION_COMMISSION не работает
if (Commission == 0)
{
const ulong Ticket = MT4ORDERS::GetPositionDealIn();
if (Ticket > 0)
{
const double LotsIn = ::HistoryDealGetDouble(Ticket, DEAL_VOLUME);
if (LotsIn > 0)
Commission = ::HistoryDealGetDouble(Ticket, DEAL_COMMISSION) * ::PositionGetDouble(POSITION_VOLUME) / LotsIn;
}
}
return(Commission);
}
I realise the post is old, but it just now hit me with a splinter.
This bit here is not correct, the commission in forex can be zero
ObjectGetValueByShift() (MT4 only), ObjectGetValueByTime() (MT4, MT5)
Thank you
I realise the post is old, but it just now hit me with a splinter.
This bit here is not correct, the commission in forex can be zero
How is it incorrect?
Problem with copy constructor in MQL5
The dynamic array this.arr, in the copy constructor, is seen by the debugger as one-dimensional.
As a result, the size of ob2.arr equals 0 in the output.
Why?
The same fragment works correctly in MQL4.
MT5 Editor
MetaEditor 5.0 1578
MT4 editor
MetaEditor 5.0 1562
The result is that size ob2.arr is 0 in the output.
Why?
Otherwise you are creating a new object.
Otherwise, unnecessary things happen.
I doubt that your code worked correctly in MQL4.
I can open a bunch of them until the deposit runs out!
I do not know how to open one pending order.
I can open a bunch of them until the deposit runs out!
Thanks in advance!
First you need to find out "who he is".
First you have to find out "who he is".
first you need to find out "who he is".
}
Well, what you do in the cycle is this:
you open a position - you open an order, the number of positions is added, the cycle repeats - to infinity.
You need to know what b and s are
Otherwise you are creating a new object.
Otherwise unnecessary things happen.
I doubt your code worked correctly in MQL4.
In real code - the function returns an object.
I think the copy constructor should create a temporary copy in this case.
The code works correctly in MQL5 build 1545.
In the new build, the copy constructor cannot resize even a one-dimensional array: Error 4007.
This is not correct in my opinion.