Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 804
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
Can you tell me what is meant in the entry
int i,limit=prev_calculated==0 ? rates_total-1 : rates_total-prev_calculated;
"==" , "?" , ": "
?
Thank you, Igor. I have not formulated it correctly. The indicator is calculated and drawn for a specified number of bars (50 in this case) and in a separate window. It needs not the open price but the first bar of the day to indicate the MA. But anyway, thank you.
read SetIndexDrawBegin() - this is a restriction for drawing the indicator buffer, never used
or in my example you can do it that way:
i.e. restrict the calculation of indicator buffers to theBarCount setting
Can you tell me what is meant in the entry
int i,limit=prev_calculated==0 ? rates_total-1 : rates_total-prev_calculated;
"==" , "?" , ": "
?
https://docs.mql4.com/ru/basis/operators/ternary
I rewrote my example, in the first version it would not work correctly when switching TFs, you need to reset dayopen and lastday, they are described with modifier static
Return also the index in the function parameter passed by reference
Returned:
double GetPatt5barsDN()
{
double low3 = 0;
int index = 0;
for(int i=1; i<20; i++)
{
if
((Close[i] > Open[i]) &&
(Close[i+1] > Open[i+1]) &&
(Close[i+2] > Open[i+2]) && //Low[i+2] is needed on this candle
(Close[i+3] < Open[i+3]) &&
(Close[i+4] < Open[i+4])
low3 = Low[i+2];
index = i+2;
}
return(low3);
return(index);
}
What should I do next?
Returned:
double GetPatt5barsDN()
{
double low3 = 0;
int index = 0;
for(int i=1; i<20; i++)
{
if
((Close[i] > Open[i]) &&
(Close[i+1] > Open[i+1]) &&
(Close[i+2] > Open[i+2]) && //Low[i+2] is needed on this candle
(Close[i+3] < Open[i+3]) &&
(Close[i+4] < Open[i+4])
low3 = Low[i+2];
index = i+2;
}
return(low3);
return(index);
}
What should I do next?
That's no way to get it back.
Like this.
Further
double min = Low[GetPatt5barsDN()];
Returned:
double GetPatt5barsDN()
{
double low3 = 0;
int index = 0;
for(int i=1; i<20; i++)
{
if
((Close[i] > Open[i]) &&
(Close[i+1] > Open[i+1]) &&
(Close[i+2] > Open[i+2]) && //Low[i+2] is needed on this candle
(Close[i+3] < Open[i+3]) &&
(Close[i+4] < Open[i+4])
low3 = Low[i+2];
index = i+2;
}
return(low3);
return(index);
}
What should I do next?
Where's the index return via a parameter by reference?
And please insert the code correctly:
Is there a function in MQL4 that can identify quotes from an account type, like 5 or 4 decimal places, what are the ways to identify how many zeros an asset has after the comma for example EURJPY has 2 decimal places, EURUSD has 4 decimal places?
https://docs.mql4.com/ru/predefined/digitsvar
Where's the index return via a parameter by reference?
And please insert the code correctly:
I seem to have got it right now:
But on compilation it generates one warning: possible loss of data due to type conversion on line:
index = GetPatt5barsDN(index);
There are no errors in the function header (or in the function itself) during compilation.