Reading indicator buffers set to chart - page 5

 
Dmitry Fedoseev:
What statement? The statement in the title is incorrect. There are no problems with reading buffers. With what problems - wrote, and still gave a link to this post. Should I still run after you and force you into it?

Aggression is inversely proportional to argumentation! Which link is the one in question - I don't understand.

Indicator and EA codes were given. It's shown that you can't get buffers in some cases through iCustom. So the headline is not just correct, it is also proven.

With iCustom restrictions of a different sort, it's similar. What's the point of your "you can" and "I don't see a problem" if nothing else is said? Don't get involved in the thread then, since you are unable to contribute any constructive substance.

 
It is impossible to write an Expert Advisor that would receive buffer values of the indicators running on a chart with non-default input parameters. Because iCustom is implemented in such a way, that it requires writing its own call in the SOURCE for each indicator.
 
comp:

It's like a kick in the head to make a statement like that. I decided to look for indicators in kodobase. I have not found ANY that uses what I am used to: event-driven model + OOP.

It's hard to say which is more: frustration or disappointment at this state of affairs. Indicators, it turns out, are REALLY primitive to write.

Show me an example where an event model combined with giving data to an EA would be needed.

I have nothing against access to indicators running on a chart. And to the structure of parameters too (by the way, MT5 already has it).

But once again I'm trying to hint that you are approaching the task from the wrong side. There is no need to hammer nails with a microscope, it is for something else.

 
comp:
It is impossible to write an EA that would receive buffer values of indicators running on a chart with non-default input parameters. Because iCustom is implemented in such a way, it requires writing its own call in the SOURCE for each indicator.

I didn't know.

owl reads buffer 0

the indy can hang on a different chart

icomp the indictor

ecomp owl

also it's possible to write values from owl to the indicator buffer

Files:
icomp_v2.ex4  8 kb
ecomp_v2.ex4  6 kb
 

Example of a script that gives the names and input parameters of all indicators running on a chart

#property strict

string GetBetweenString( string &SourceString, const string BeginString, const string EndString = "" )
{
  string Str = SourceString;
  int Pos1 = 0;
  int Pos2 = 0;

  if (BeginString != "")
    Pos1 = StringFind(SourceString, BeginString);

  if (Pos1 >= 0)
  {
    Pos1 += StringLen(BeginString);

    Pos2 = StringFind(SourceString, EndString, Pos1);

    if (Pos2 != Pos1)
      Str = StringSubstr(SourceString, Pos1, Pos2 - Pos1);
    else
      Str = "";
  }

  SourceString = StringSubstr(SourceString, Pos2 + StringLen(EndString));

  return(Str);
}

string FileToString( const string FileName )
{
  string Res = "";

  const int handle = FileOpen(FileName, ::FILE_READ|::FILE_BIN);

  if (handle != INVALID_HANDLE)
  {
    uchar Array[];

    FileReadArray(handle, Array);

    Res = CharArrayToString(Array);

    FileClose(handle);
  }

  return(Res);
}

string GetIndicatorsData( const long Chart_ID = 0 )
{
  string Res = "Current chart:";

  const string FileName = ::WindowExpertName() + ".tpl";

  if (ChartSaveTemplate(Chart_ID, "..\\MQL4\\Files\\" + FileName))
  {
    string Str = FileToString(FileName);

    int PosName = StringFind(Str, "name=Custom Indicator");

    while (PosName > 0)
    {
      const string IndicatorName = GetBetweenString(Str, "<indicator>\r\nname=Custom Indicator\r\n<expert>\r\nname=", "\r\n");

      Res += "\n\nIndicator: " + IndicatorName;

      const int PosInputs = StringFind(Str, "<inputs>");
      PosName = StringFind(Str, "name=Custom Indicator");

      if (PosInputs > 0)
        if ((PosName < 0) || (PosName > PosInputs))
          Res += "\nInputs:\n" + GetBetweenString(Str, "<inputs>\r\n", "\r\n</inputs>");

      Res += "\n\nLast Null Buffer Value (ONLY Default Inputs) = " + (string)iCustom(Symbol(), Period(), IndicatorName, 0, 0);
    }
  }

  return(Res);
}

void OnStart( void )
{
  MessageBox(GetIndicatorsData());

  return;
}

This data should be enough to calculate the values of the indicators. But because of the iCustom "ellipsis" it is impossible to do it.

 
pako:

I didn't know.

owl reads buffer 0

the indy can hang on a different chart

icomp the indictor

ecomp owl

Sources?
 
comp:
The sources?
There's no motivation.
 
comp:

An example of a script that outputs the names and input parameters of all indicators running on a chart

This data should be enough to calculate the values of the indicators. But because of the iCustom "ellipsis" it is impossible to do it.

do you want to know which indicator is on the chart and its parameters?

you can see the name

how much and what parameters you can see

and the script shows the correct


name and how many parameters

 
pako:

do you want to know which indicator is hovering on the chart and its parameters?

No, I want to understand what is not working in your example, because your EA does not show changing indicator data.

 
comp:

No, I want to understand what is not working in your example because your EA is not showing changing indicator data.

it shows data from buffer 0

it shows the data from buffer 0.