В качестве первого операнда – "выражение1" – может быть использовано любое выражение, результатом которого является значение типа bool. Если результат равен , то выполняется третий операнд – "выражениеЗ". Второй и третий операнды, то есть "выражение2" и "выражениеЗ", должны возвращать значения одного типа и не должны иметь тип void...
It's just awful! If I can still trace the logic in the Expert Advisors, correct some things, add some more... I don't understand the code of indicators at all(
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
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
В качестве первого операнда – "выражение1" – может быть использовано любое выражение, результатом которого является значение типа bool. Если результат равен , то выполняется третий операнд – "выражениеЗ". Второй и третий операнды, то есть "выражение2" и "выражениеЗ", должны возвращать значения одного типа и не должны иметь тип void...
Is there a function in MQL4 that can detect whether a quote is a 5 or 4 decimal place, how many decimal places an asset has for example EURJPY has 2 decimal places, EURUSD has 4 decimal places?
Seric29: 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?
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.