Search first:
Bare in mind there is practically nothing that has not been programmed for MQ4/5 yet! So search first!
Its easier and the result has fff: far fewer faults than a do-it-yourself-EA generally speaking!
For your approach have a look into the ZigZag-Indicator or a daily-High-Low and amend them according to your ideas.
Just because of the 4 buffers for op, hi, lo, cl there wont be any candle painted in the second window. You have to use graphical objects. Even here search for "draw candles" and you would find e.g. this: https://www.mql5.com/en/code/12270.
Again search first instead of trying to invent the wheel again there are tons of wheels here ;)

- www.mql5.com
Alright.
As you suggested Mr.Watford I used the iCustom function to display the values (double) of the two buffers(0 and 1). But in the test the values did not change at all. They always stayed at 0,00000000.
Here is the function:
double val=iCustom(NULL,0,"AK_ZigZag ROYAL Pointer",ExtDepth,ExtDeviation,ExtBackstep,0,0);
double Value21=iCustom(NULL,0,"AK_ZigZag ROYAL Pointer",ExtDepth,ExtDeviation,ExtBackstep,1,0);
Alright.
As you suggested Mr.Watford I used the iCustom function to display the values (double) of the two buffers(0 and 1). But in the test the values did not change at all. They always stayed at 0,00000000.
Here is the function:
double val=iCustom(NULL,0,"AK_ZigZag ROYAL Pointer",ExtDepth,ExtDeviation,ExtBackstep,0,0);
double Value21=iCustom(NULL,0,"AK_ZigZag ROYAL Pointer",ExtDepth,ExtDeviation,ExtBackstep,1,0);
zigzag indicators have many bars with no value. Pick a bar that you know has a value.
Check your experts tab to make sure that the indicator name is correct. As there will be an entry if it cannot locate the indicator.
Thanks. Working on it.
This time I started the test at a candle, that in the data window had its Low[] value under the name ZigZag(100,75,15). I don´t know what buffer exactly it is. I think thats why the value I´m using from the iCustom function is not the same as in the data window. What do you think?
Try different buffers, but if the buffer label is "value x", the buffer is normally x-1

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello there!
Indicator:
In the end, this indicator draws arrows at the maximums and minimums on the chart of every candle, but displays only some of them. Not all. I tried to convert it into an expert advisor, that opens and closes trades everytime an arrow appears on the chart. But all I got until now, is that it opens and closes trades immediatly with every tick. I am glad with every comment you´ll write. Thanks.