I apologise for the obtuseness, but I'd rather use my example to understand how to organise this - there is a function that is called many times in code in different places - now it returns one value, but I also need, say, 2 _High and _Low - how should this be done?
int BarPeresek_iMAf(int PeriodMA)
{
int TFT=0;
int shiftMAT=0;
int typeMAT=0;
int priceMAT=0;
int BarPeresek=0;
if(Bars>PeriodMA)
{
for(int X=1;X<1000; X++)
{
double MAT=NormalizeDouble(iMA(Symbol(),TFT,PeriodMA,shiftMAT,typeMAT,priceMAT,X),Digits);
if((Low[X]>MAT && High[X]>MAT) ||
(Low[X]<MAT && High[X]<MAT))BarPeresek++;
else {BarPeresek++; break;}
}
}
double _High=High[BarPeresek]; //Надо получить сразу из функцииdouble _Low=Low[BarPeresek]; //Надо получить сразу из функцииreturn BarPeresek;
}
I apologise for the obtuseness, but I'd rather use my example to understand how to organise it - there's a function which is called many times in code in different places - now it returns one value, but I also need, say, 2 _High and _Low - how should this be done?
OnTick()
{
double _High=High[BarPeresek_iMAf(Per_MA)];
double _Low=Low[BarPeresek_iMAf(Per_MA)];
}
int BarPeresek_iMAf(int PeriodMA)
{
int TFT=0;
int shiftMAT=0;
int typeMAT=0;
int priceMAT=0;
int BarPeresek=0;
if(Bars>PeriodMA)
{
for(int X=1;X<1000; X++)
{
double MAT=NormalizeDouble(iMA(Symbol(),TFT,PeriodMA,shiftMAT,typeMAT,priceMAT,X),Digits);
if((Low[X]>MAT && High[X]>MAT) ||
(Low[X]<MAT && High[X]<MAT))BarPeresek++;
else {BarPeresek++; break;}
}
}
return BarPeresek;
}
Hello, could you please tell me how to programmatically understand that the price has approached a circular level?
Can you tell me how to correctly return multiple values from a function?
Let's say I have an ABC function - I want to get the values of three variables at once, how do I do this?
Can you tell me how to correctly return multiple values from a function?
Let's say I have an ABC function - I want to get the values of three variables at once, how do I do this?
I think so.
Thank you.
But I don't get it, if my input is 2 variables for calculation, and output should be 3 (with different int and double types ), what should I do?
Thank you.
But I don't know, if my input is 2 variables for calculation, but the output should be 3 (with different int and double types ), what should I do?
Thank you.
But I don't know, if my input is 2 variables for calculation, but the output should be 3 (with different int and double types ), what should I do?
I apologise for the obtuseness, but I'd rather use my example to understand how to organise this - there is a function that is called many times in code in different places - now it returns one value, but I also need, say, 2 _High and _Low - how should this be done?
I apologise for the obtuseness, but I'd rather use my example to understand how to organise it - there's a function which is called many times in code in different places - now it returns one value, but I also need, say, 2 _High and _Low - how should this be done?