The solution via DLL is given in the article"Data transfer between indicators - a simple solution of this problem". But you have to add the call of externalGetPtr to the indicator source code, which is not always possible.
Without DLL is it possible to perform only reading (without writing, which is also done in the article) of buffers? Has anything changed on this topic since the time the article was written (2010)?
- docs.mql4.com
How many values do you need? Let the indicator itself save the duplicates of these values in global variables of the terminal, in properties of objects in the chart, in files
I need a script to get the values of buffers (at least one) of an indicator on a chart. Dumping buffers from an indicator to a file is not a script reading buffers.
In the article above, there is a nice solution via pointers that allows you to not only read, but even overwrite the buffers of other indicators on the charts. This is what is called a buffer read. But it is a DLL.
You see, we can implement the following scheme
- the indicator waits for a global variable to write its buffers to the file.
- The script creates such variable at runtime and receives the corresponding files.
For some reason they still can't do a human readout of the indicator data from the chart! Sounds delusional, but it is.
Unfortunately, in this case
is not going to help.
Why not? iCustom() reads the indicator buffer, regardless of how this buffer is filled. After all, the buffer is declared at the level of global variables in any case.
Because iCustom knows nothing about Timer and ChartEvent events.
For example, the indicator on the chart every second (Timer event) fills its only buffer with random numbers (or applies EMA to previous buffer values). This is quite a few lines of code. iCustom in this case will never return what you will see on the chart.
Because iCustom knows nothing about Timer and ChartEvent events.
For example, the indicator on the chart every second (Timer event) fills its only buffer with random numbers (or applies EMA to previous buffer values). This is quite a few lines of code. iCustom will then never return what you will see on the chart.
Why not? iCustom() reads the indicator buffer, regardless of how this buffer is filled. After all, the buffer is declared at the level of global variables in any case.
iCustom doesn't read buffers from the indicator on the chart, it creates its own copy of the indicator in the memory and reads from it, just the buffer copies are not displayed on the chart. But if the indicator draws something on the chart independently, it will be drawn when called via iCustom that creates problems, by the way
For example, if the indicator has the following code, it will be drawn when calling iCustom, and the text will overlay the text of the indicator on the chart
ObjectSetString(0, ShortName, OBJPROP_TEXT, "какой-то текст"); ChartRedraw();
iCustom doesn't read buffers from the indicator on the chart, it creates its own copy of the indicator in the memory and reads from it, just the buffer copies are not displayed on the chart. But if the indicator draws something on the chart independently, it will be drawn when called via iCustom that creates problems, by the way
For example, if the indicator has the following code, it will be drawn when calling iCustom, and the text will overlay the text of the indicator on the chart
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
An indicator is placed on the chart. It is redrawn by Timer, ChartEvent and Calculate events.
I need a script to read the current values of its indicator buffers(INDICATOR_DATA) which can be seen by CTRL+D. Is it possible to do this in MT4?