Help write a function that returns the bar of the last MA crossing, given that there are 10 bars between the last and penultimate crossing and from the point of last crossing to the minimum there is a given number of points. for the third day I'm struggling all is not working out a file with the code attached
Artyom Trishkin: 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:
//--- counted in the 1-st bufferfor(i=0;i<limit;i++)
{
int bars=iBarShift(Symbol(),PERIOD_M1,iTime(Symbol(),PERIOD_CURRENT,i),false);
ExtBuffer[i]=(
iMA(NULL,PERIOD_CURRENT,1,0,MODE_SMA,PRICE_HIGH,i)
+iMA(NULL,PERIOD_M1,1,1,MODE_SMA,PRICE_OPEN,bars)
);
Print(bars);
}
intBars(
string symbol_name, // имя символаENUM_TIMEFRAMES timeframe, // периодdatetimestart_time, // с какой датыdatetime stop_time // по какую дату
);
Time the i-th bar and put the resulting bar number instead of i.
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 ))))
Данная статья, построенная в форме справочника по функциям MQL4, призвана помочь переходу с MQL4 на MQL5. Для каждой функции языка MQL4 приведено описание и представлен способ ее реализации на MQL5, что позволит вам значительно ускорить перевод своих программ с MQL4 на MQL5. Для удобства функции разбиты на группы, как в документации по MQL4.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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