Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 224
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 branch is quadruped.
The branch welcomes cross-platform code to ease the transition for newcomers to Five.
Frankly, I have exhausted myself but still do not understand how to reproduce these calculations in Five:
Frankly, I struggled but still don't understand how to reproduce these calculations in Five:
I suggested a universal code
Forum on trading, automated trading systems & strategy testing
Any MQL4 beginners questions, help and discussion on algorithms and codes
Alexey Viktorov, 2017.06.02 14:27
Try
Time the i-th bar and put the resulting bar number instead of i.
It works in both mql4 and mql5.
I immediately suggested a universal code
it works in mql4 and mql5.
But how in 5 to get
start_time, // с какой даты
there
iTime()
does not work.
But how do you get in a fiver
here
does not work.
CopyTime works.
But it is not needed in this case, because time of current period is in time[i], it's an indicator...
Hi all. Help me with OrderProfit() function. How to make Comment display the current profit of all open orders. I get the same number.
double CalcProfit()
{
double Profit = 0;
for (int i=OrdersTotal() - 1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if (OrderType() == OP_BUY)
{
Profit += (OrderProfit() + OrderSwap() + OrderCommission())
}
}
}
}
return(Profit);
}
Hi all. Help me with OrderProfit() function. How to make Comment display the current profit of all open orders. I get the same number.
double CalcProfit()
{
double Profit = 0;
for (int i=OrdersTotal() - 1; i>=0; i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if (OrderType() == OP_BUY)
{
Profit += (OrderProfit() + OrderSwap() + OrderCommission())
}
}
}
}
return(Profit);
}
That's it. Got it.
But how do you get in a fiver
here
doesn't work.
for starters
https://www.mql5.com/ru/articles/81
I personally first write in 4-Rock, then I change it to 5-Rock, otherwise it's too much trouble for me, because 5-Rock code is harder to read, functions are too long in number of letters..., so it turns out the text for gum scholars, not for engineers ))))
and behold
https://www.mql5.com/ru/search#!keyword=f%20mql4%20to%20mql5