Maxima

 

Alright, just look into the code and suggest why this indicator does not work, and if possible post a working solution,'

Files:
maxima.mq4  3 kb
 

Try this:

double a[10000];

 

Array size

Please find attached a fixed version.

maxima.mq4

Files:
maxima.mq4  3 kb
 

...

If you want to use "a" as array and not as buffer, than the logic of handling it should be changed (metatrader does not treat them equally). The simplest is to use it as buffer (attached here) if you have buffers to spare

PS: change th way your loops work too. The for(i=0; i <= Bars; i++) and for(i=0; i <= Bars-1; i++)modes calculate every bar on every tick and it is not necessary

Files:
maxima.gif  16 kb
maxima_1.mq4  3 kb
 
mladen:
If you want to use "a" as array and not as buffer, than the logic of handling it should be changed (metatrader does not treat them equally). The simplest is to use it as buffer (attached here) if you have buffers to spare PS: change th way your loops work too. The for(i=0; i <= Bars; i++) and for(i=0; i <= Bars-1; i++)modes calculate every bar on every tick and it is not necessary

wow, thanks for the tip

second question is, why do the loops never work in EA's but when called as custom indicator works well.

 
junglelion:
wow, thanks for the tip second question is, why do the loops never work in EA's but when called as custom indicator works well.

simple, for loops to work on ea must of condition. if it matched the condition or not. if so do something. you have to look though the code, the to see what condition need to put in there

 

Petor

mladen:
If you want to use "a" as array and not as buffer, than the logic of handling it should be changed (metatrader does not treat them equally). The simplest is to use it as buffer (attached here) if you have buffers to spare PS: change th way your loops work too. The for(i=0; i <= Bars; i++) and for(i=0; i <= Bars-1; i++)modes calculate every bar on every tick and it is not necessary

Thank You very much, Mladen! The "Maxima" is wonderful. Thank You!

 

What does this indicator do? I mean, I can see how it should be used, but I'm curious of how it works. It looks kind of like a slope line. Is that it?