i looked at it. it will take me a week to study it in details. but what's worse, i couldn't find any places that would be relevant to my task. i don't color indicators, and i don't modify them in any way. i just want to find maxima and minima on n-last bars. there's a hint of similarity in RSI_Extremums_Sample.mq4 but i can't handle this code. it's too much unnecessary, the indicator DRAWNS.... and i don't need it...
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 17.05.2008 |//| Описание : Возвращает значение максимального элемента массива. |//+----------------------------------------------------------------------------+//| Параметры: |//| x - массив значений числового ряда |//+----------------------------------------------------------------------------+double ArrayMax(double& x[]) {
if (ArraySize(x)>0) return(x[ArrayMaximum(x)]);
else {
Print("ArrayMax(): Массив пуст!");
return(0);
}
}
question: how do I create an array of indicator values?
2) take the source code from the MACD, there is a buffer there
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recountedif(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st bufferfor(int i=0; i<limit; i++)
MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd bufferfor(i=0; i<limit; i++)
SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
//---- donereturn(0);
}
I need to determine the minimum (as shown in the picture) and maximum MACD indicator value for a given number of bars. (20 in this case).
I found a code that does this for price, and stupidly tried to replace HIGH LOW with MACD. but nothing worked....
Copy the MACD data you need into massMACD[20] array and find the minimum ArrayMinimum(massMACD); and maximum ArrayMaximum(massMACD); values in that array.
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.
i looked at it. it will take me a week to study it in details. but what's worse, i couldn't find any places that would be relevant to my task. i don't color indicators, and i don't modify them in any way. i just want to find maxima and minima on n-last bars. there's a hint of similarity in RSI_Extremums_Sample.mq4 but i can't handle this code. it's too much unnecessary, the indicator DRAWNS.... and i don't need it...
Is it possible with the " ArrayMaximum" function, to calculate the nearest maximum of a custom indicator?
Or do I need other functions for that?
I have tried it this way:
And nothing comes out. Gurus, can you tell me how to do it?The only thing I don't understand is how to calculate extrema of the MACD indicator, for example, instead of extrema of the price over n periods ?
I think I need to change HIGH and LOW to MACD in the key block... But I don't understand how ... all my attempts to goof around ended in nulling.
I understand that I need to create a MACD array...
double MACDBuffer[];
I've also seen such a string in other Expert Advisors
but I can't just measure one on the other...
Please, advise how to do it?
Article.
found something similar in Kim's
question: how do I create an array of indicator values?
found something similar in Kim's
Question: how do I create an array of indicator values?
i reread what was asked, i got it wrong at first (
to get a buffer of indicator data, you can
1) run a loop with collecting iMACD values in the buffer
2) take the source code from the MACD, there is a buffer there
reread what was asked, got it wrong at first(
To get a buffer with the data of an indicator you can:
1) run a loop with collecting iMACD values in the buffer
2) take the source code from the MACD where the buffer is
How do I visualize the buffer, otherwise I don't understand what to do with it....
Print(MACDBuffer[1]); ?? it prints zero... why? in theory it should be the value of the 1st bar....
and another thing... why calculate MACD using MA when there is a direct function iMACD ???
and how do i visualise the buffer otherwise i don't understand what to do with it....
Print(MACDBuffer[1]); ?? it prints zero...why? it should be the value of the 1st bar....
and another thing... why calculate MACD using MA, when there is a direct function iMACD ???
Please tell me what you need,
but it should be clearer, so that even a dumb person can understand it.
Please tell me what you want,
but in a clear way, so that even the dumb one understands.
I need to determine the minimum (as on the picture) and maximum values of the MACD indicator for a given number of bars. (20 in this case).
I found the code that does this for the price, and stupidly tried to replace HIGH LOW with MACD. but nothing worked....
It is the job of the DCs to give a good story. They are lazy and always blame the MCs.
Thank you!
I need to determine the minimum (as shown in the picture) and maximum MACD indicator value for a given number of bars. (20 in this case).
I found a code that does this for price, and stupidly tried to replace HIGH LOW with MACD. but nothing worked....
PS. although this is more correct and better:
I need to determine the minimum (as shown in the picture) and maximum MACD indicator value for a given number of bars. (20 in this case).
I found a code that does this for price, and stupidly tried to replace HIGH LOW with MACD. but nothing worked....
Copy the MACD data you need into massMACD[20] array and find the minimum ArrayMinimum(massMACD); and
maximum ArrayMaximum(massMACD); values in that array.