Discussion of article "Data Exchange between Indicators: It's Easy" - page 2

 
<br/ translate="no">

...Only one question is how to convert a pointer into an integer. This is where the Dynamic Link Library will help us, namely, C++ capabilities of data type conversion. Since pointers in C++ are a four-byte data type, it is convenient to use the four-byte int type for our purposes...

If I'm not mistaken, the author is talking about implicit type conversion. This is a very informative article - many thanks to the author.

I also wanted to add that if you need to make a SetPtr method, you can't do without explicit type conversion.

It will look like this

double* SetPtr(int a)
{
  double* a1 = reinterpret_cast <double* > (a);
  return(a1);
}

In general, MQL5 would benefit a lot if pointers were widely recognised and used.

 

In general, MQL5 would benefit greatly if pointers were widely recognised and used.

I would add to this list exception handling, constructors with parameters and multiple inheritance.

But for some reason developers think that we are not smart enough to take advantage of all these features and will only hurt ourselves.

Although all of the above are standard OOP tools and have never hurt anyone.

I get the impression (from me) that they are simply unable to implement these mechanisms reliably.

It's sad that someone decided that we won't have it here

 

I've noticed that with the new MT4 builds the SetIndicatorValue() function doesn't work, but GetIndicatorValue() does. Is this just me, or is there something in the new builds (I think the change happened somewhere after Build 225) that broke that function? If so, any suggestions on how to get the methodologies in this article to work on the new MT4 builds? The fact that the old builds aren't supported anymore is causing me a problem in this regard, as I'd really like to have indicator calculations happen only once, in an EA, but still be displayed on charts by pushing the calculated values to the indicator buffers' pointers. (BTW, I was really grateful to find this article and to be able to apply its techniques - thank you for writing it.)

A related question is that I noticed that on the release notes for Build 392 of MT4 on 3/17/2011, it says, "3. Removed unnecessary recalculations of indicators when displaying them on a chart." Does this improvement effectively negate the need for the techniques in this article in that using custom indicators in the way they were intended will no longer be slower than using the pointer-based techniques taught in this article? Thank you.

 
brisully:

I've noticed that with the new MT4 builds the SetIndicatorValue() function doesn't work, but GetIndicatorValue() does. Is this just me, or is there something in the new builds (I think the change happened somewhere after Build 225) that broke that function? If so, any suggestions on how to get the methodologies in this article to work on the new MT4 builds? The fact that the old builds aren't supported anymore is causing me a problem in this regard, as I'd really like to have indicator calculations happen only once, in an EA, but still be displayed on charts by pushing the calculated values to the indicator buffers' pointers. (BTW, I was really grateful to find this article and to be able to apply its techniques - thank you for writing it.)

A related question is that I noticed that on the release notes for Build 392 of MT4 on 3/17/2011, it says, "3. Removed unnecessary recalculations of indicators when displaying them on a chart." Does this improvement effectively negate the need for the techniques in this article in that using custom indicators in the way they were intended will no longer be slower than using the pointer-based techniques taught in this article? Thank you.

It seems I was mistaken, and that the indicator files attached to the article do work in the new builds of MT4. Sorry for the false alarm, and thanks again for this work.
 
Zhunko:

How complicated it is!...

With the help of Ilnur a year ago I wrote a library in MQL4 for working with memory. You can allocate memory, move pointers, write and read, transfer the name of memory area to any other programme.

Everything is based on mapping. It is much simpler than the proposed one.

How can I get this library? I would be grateful. I need to transfer data between two MTs.
 
thank you
 

Is it possible to add functions to DLL not only for working with double, but also for datetime, for long and for int?

It turns out that now the data from price arrays can be easily transferred between nested structures without copying, but data on time, spread and volumes must still be copied.

I tried to adapt GetPtr to work with datetime and long (and through perversions with moving int bits) - it doesn't work, the function accepts a reference to an array and it can't be converted.

Has anyone solved this problem?

 

Silence.

Eh... I'll have to remember C++ and install MSVC myself...

 
Laryx:

Silence.

Eh... I'll have to remember C++ and install MSVC myself...

And now nobody will answer you anything, everyone has gone to the front.

Have you heard anything about MT4 update?

 

By the edge of my ear, by the edge of my ear... :)

MT4 update is very good for me - I have large libraries, but all of them are on MT5 (I can't imagine my life without OOP). And DCs, bad people, not all of them have MT5 in real life.... So this news is very good for me.

But - until there will be a normal MT4++, I don't see the point of adapting the code for the updated platform. When something like an official beta comes out (yes, with the Standard Library, I don't want to write Expert Advisors without it either) - then we will start converting the code....

And now I - terribly want to get addresses not only of double arrays, but also of other arrays... Ah - yuk... I wanted to bypass the problem through type conversion (time and longs are also eight-byte), but it doesn't work yet....