Something interesting, old thread - page 47

 

Mladen thank you!

I was so confuse between arrays function that I forgot the most important thing, insert buffers for calculation!!!

I'm terrible on coding

mladen:
Doc Try it out now
 

I'm a bit frustrated today,

sorry Mladen but I don't understand some different things about coding in mql5...

for example why sometimes array and other times buffer? are not the same?

another point that I cannot understand is why metaquotes didn't make an include file for all common indicators, to be easy to insert a reference

 
dr.house7:
I'm a bit frustrated today, sorry Mladen but I don't understand some different things about coding in mql5...

for example why sometimes array and other times buffer? are not the same?

another point that I cannot understand is why metaquotes didn't make an include file for all common indicators, to be easy to insert a reference

The basic difference between arrays and buffers is that buffers sizes are managed automatically while for the arrays you need to write the size maintaining code by your self. Other than that there is no difference in metatrader 5 between the 2 (if you don't want to make it visible on chart of course)

 

...and also I don't understand why most indicators don't follow the ring buffer method: The class to create the ring buffer - MQL5 Code Base

 
dr.house7:
...and also I don't understand why most indicators don't follow the ring buffer method: The class to create the ring buffer - MQL5 Code Base

Doc

Quite frankly I do not see any advantage in using ring buffers (and in some cases it will directly affect the precision of calculation). It is just someone showing that classes can be made in metatrader 5.

Once when I compared the speed of execution of a same code written as a class and as a classical code, I didn't even need a timer to test the difference : it was that big a difference. So, in my opinion, classes (objects) should be avoided in any place where speed and efficiency is required from the code

 

I agree with you but not 100% I think of those people who have strategies of hundreds of indicators working together

 
dr.house7:
I agree with you but not 100% I think of those people who have strategies of hundreds of indicators working together

Doc

If we would use ring buffers, then everything, but I mean everything, would need to be rewritten. And even without ring buffers, due to a less than intelligent way how "external" indicators can be accessed in metatrader 5, all needs to be rewritten

Unfortunately, since they discontinued the iCustom() calls, we need to rewrite all as functions to make all usable as it should be (try changing "on-the-fly" some of the parameters in the indicators call in metatrader 5 for example and you will see what I mean - while when we write it as our own function we can do whatever we want). And in functions we can use arrays as a logical way of replacing buffers (they become local to the function, they can be multi instance, and they can be fast unlike the classes) so the best place where we can use arrays instead of buffers is in functions

 
mladen:
Doc

If we would use ring buffers, then everything, but I mean everything, would need to be rewritten. And even without ring buffers, due to a less than intelligent way how "external" indicators can be accessed in metatrader 5, all needs to be rewritten

Unfortunately, since they discontinued the iCustom() calls, we need to rewrite all as functions to make all usable as it should be (try changing "on-the-fly" some of the parameters in the indicators call in metatrader 5 for example and you will see what I mean - while when we write it as our own function we can do whatever we want). And in functions we can use arrays as a logical way of replacing buffers (they become local to the function, they can be multi instance, and they can be fast unlike the classes) so the best place where we can use arrays instead of buffers is in functions

yes I think many different things should be rewritten in the metaeditor, just to be more intuitive and more performance...and the iCustom function is simply embarrassing

 

vaMA

vaMA indicator coded by J.B

Files:
vama.gif  45 kb
vamacl.mq5  5 kb
 
mladen:
Doc Try it out now

Good morning Mladen,

I don't understand, the indicator seems react with level 0 instead of SMA...what's wrong? It should show the signal of cci crossing the sma, not the 0 level.

I tried on m1 with period1=3 and period2=3

Reason: