Indicator getting corrupted

 

All,

I have developed an indicator which runs fine for the first 16 hrs or so, after which it gets corrupted and starts to draw lines all over the chart. I am also checking the value of IndicatorCounted() and its value does not become negative when I get the corrupted lines. I do not want to reinitialize the indicator buffers as the history of 'valid moves/lines' will get lost. Any suggestions on fixing the problem?

Images of normal and corrupt indicator available in attached zip file.

Files:
images.zip  61 kb
 
No mind readers here - no code = no help
 
WHRoeder:
No mind readers here - no code = no help

Thanks a ton.
 

dears,

can someone send me the link to download the metaEditor 4?

thank you.

 
tiger961:

dears,

can someone send me the link to download the metaEditor 4?

thank you.


Tiger you need to start a new thread instead of piling onto other threads.

The editor is available with free MT4 terminal download from any broker.

 

Some further info -

a) Corruption of indicators happens only on Windows 64 bit platform

b) I have taken a dump of the indicator array before corruption and after corruption - the same are available in the enclosed xls file with comments.

c) Is "Max Bars in Chart" setting applicable only when you open up the chart? The bar count and associated indicator count grows with each additional bar added.

d) Code use is as follows

Declarations

<code>

#property indicator_chart_window

#property indicator_buffers 8

#property indicator_color1 Red

#property indicator_width1 2

</code>

For inidicator initialization -

<code>

SetIndexBuffer(0, Down1);

SetIndexStyle(0, DRAW_LINE);

SetIndexEmptyValue(0, EMPTY_VALUE);

</code>

For addition of line data

<code>

void DrawMoveEx(double& serie[], int start, int end, double startlevel, double endlevel) {

double a = (endlevel - startlevel) / (start - end);

double y;

int bar;


for(int x = 0; x <= start - end; x++) {

y = a * x;

bar = start - x;

serie[bar] = startlevel + y;

}

}

</code>

 
AnkaSoftware:
a) Corruption of indicators happens only on Windows 64 bit platform
Don't install int \program files* on Vista/Win7
 
WHRoeder:
Don't install int \program files* on Vista/Win7
Right, the installation is in C:/metatrader4/<terminal dir>. I believe this problem is not due to path problems but due to memory corruption. The indicator runs fine for first 3-4 hrs, after which the corruption starts.
 

I suspect it's nothing of the sort . . .

I have seem something similar happen when new historical data is added to the chart by scrolling the chart to the right.

 
RaptorUK:

I suspect it's nothing of the sort . . .

I have seem something similar happen when new historical data isadded to the chart by scrolling the chart to the right.

Hmm, "new historical data isadded to the chart ", how? The indicator is started and left undisturbed. We have a fixed lookback of 1000 bars. The indicator is not loading any historical data.

Can somebody from development team have a look at this?

 
AnkaSoftware:

Hmm, "new historical data isadded to the chart ", how? The indicator is started and left undisturbed. We have a fixed lookback of 1000 bars. The indicator is not loading any historical data.

Can somebody from development team have a look at this?

I'm with RaptorUK on this: it is colossally unlikely that this is a bug in MT4 rather than your code, or anything to do with 64-bit Windows. I've seen reports of performance and stability issues with MT4 which turned out to be well-founded (e.g. https://www.mql5.com/en/forum/135355) but I've never seen a report of an MT4 language bug which turned out to be correct.

Let me point out one difference between your "Move Normal" and "Move Error" screenshots. In "Move Normal", there are no apparent missing bars. Whereas in "Move Error", there seems to be missing chart data. Most of the markers on the X axis are 16 minutes apart, but the gap between the second and third markers is 21 minutes (06:08 to 06:29). This may or may not be the problem, but I'd start looking in your code for places which assume that there's going to be a continuous series of bars. For example, if it's currently 8am, anything in the code which assumes that (a) the bar for 7am is 60 bars ago, or even (b) that a bar for 07:00 exists at all.