Questions from Beginners MQL5 MT5 MetaTrader 5 - page 466

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
Greetings all. I have such a question. I have an indicator (modified fractals), when loaded on a chart everything is correct, works as it should, but when I try to use it in an EA, it says that the buffer is empty. At the same time, when passing the buffer in Deinit, it stores the correct values.
The source code of the indicator is attached. I am ready to listen to tips and suggestions what I am doing wrong.
Code from EA:
You could replace the if's at the end with:
(if it's as simple as that,,,:)
Thanks
Greetings all. I have such a question. I have an indicator (modified fractals), when loaded on a chart everything is correct, works as it should, but when I try to use it in an EA, it says that the buffer is empty. At the same time, when passing the buffer in Deinit, it stores the correct values.
The source code of the indicator is attached. I am ready to listen to tips and suggestions what I am doing wrong.
The code is from the Expert Advisor:
A very cursory glance. Question: can a fractal be on a zero bar? But in OnDeinit() you loop through the bars and, of course, find a fractal (not an empty buffer value).
In Deinit, I also pass through 4-6 and everything is at its place.
In OnDeinit() you run in a loop (from 0 to 100) through the bars looking for a non-zero value and log the value found.
In OnTick() you try to output only the last 6 bars of buffer 0. There might be no fractal on them.
First, find the bar with the fractal and then print the value of that bar.
In OnDeinit() you run in a loop (from 0 to 100) through the bars looking for a non-zero value and log the value found.
But in OnTick(), you try to print only the last 6 bars of buffer 0. There may be no fractal on them. First, find the bar with the fractal and then print the value of this bar.
The 6th bar is supposed to contain fractal.
2015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 29 fractal Up: 1.098552015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 21 fractal Up: 1.09976
2015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 16 fractal Down: 1.09652
2015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 6 fractal Up: 1.10721
2015.11.01 13:19:10.577 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: Deinit Function
2015.11.01 13:19:08.380 2015.10.01 00:00 MoneyRobotics_Proboi! test started
That's the beginning of the log. The test started, the Expert Advisor worked, Deinit was loaded and fractal was found at 6. I don't know how to address the indicator buffer.
https://charts.mql5.com/9/256/eurusd-h1-alpari-limited-3.png
image replay.
the 6th bar is supposed to contain a fractal.
2015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 29 fractal Up: 1.098552015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 21 fractal Up: 1.09976
2015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 16 fractal Down: 1.09652
2015.11.01 13:19:11.023 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: x = 6 fractal Up: 1.10721
2015.11.01 13:19:10.577 2015.10.30 22:54 MoneyRobotics_Proboi! EURUSD,H1: Deinit Function
2015.11.01 13:19:08.380 2015.10.01 00:00 MoneyRobotics_Proboi! test started
This is the beginning of the log. start of the test, the Expert Advisor has worked out, Deinit starts, and immediately on the 6th position it finds a fractal.
https://charts.mql5.com/9/256/eurusd-h1-alpari-limited-3.png
I do not know how to address the indicator buffer.
This one:
do
prevtime = Time[0];
at the very end
This:
do
at the very end.
how can this affect it? unfortunately nothing has changed.
how i imagine the process: the indicator is loaded, starts to check every tick/bar condition, if the condition is met, puts the value in the selected buffer or buffers, then the EA calls the indicator by the buffer number to the value at a certain offset and takes the value. Right?
how can this affect it? unfortunately, nothing has changed.
how i imagine the process: the indicator is loaded, starts to check the condition every tick/bar, if it is met, puts the value in the selected buffer or buffers, then the EA calls the indicator by the buffer number to the value at a certain offset and takes the value. Right?
Why is there a new bar control in the indicator? Apparently there are no complicated calculations