With usability and efficiency in mind: what is an optimal number of buffers in a scalable indicator?

40% 8 (previous standard de facto from MT4)
13% 16 (twice as the standard, without a reasoning)
13% 32 (looks like somewhat number of Forex majors and crosses)
7% 64 (looks like Forex with exotics, an overkill imho)
27% another option (can explain)
Total voters: 15

Number of indicator buffer is unlimited. There exist indicators, implemented in a generalized scalable way (for example, multicurrency, multiperiod), which can handle an arbitrary number of buffers. AFAIK, MQL does not allow us at the moment to specify number of buffers dynamically, as input parameter - that would make this question trivial.

Currently, a developer must choose a specific limit and hardcode it in the product. If this is a fairly large number, useless memory consumption will increase (because most of users will leave excessive buffers idle), charts could become a mess of lines, and Data Window will be populated with a lot of empty rows.

So, which is an optimal number of indicator buffers? The question is about visible buffers, not about internals.

As much as you need and probably more.

This is not about me, this is about users. A generalized indicator will be used for different use-cases.

Maximum number of buffers is 512.

About your topic, I don’t really understand what you are asking. There is no general answers, it depends of the needs (what indicator) and the resources available (what computer, memory). An other problem is we don’t have control on buffers, if the platform settings are 5,000 or 65,000 or 100,000,000 bars on a chart, it’s very different. A lot of improvement could be done, but I have no idea if Metaquotes want to do invest in such advanced features.

On an other side, I don’t see clearly what could be the advantages a “generalized scalable” indicator(s) ? Do you have example(s) ? Of course the code could be generalize and scalable but isn’t better to just compile different versions with just needed buffers ?

According to this documentation page - “No limit for the number of indicator buffers” in MT5. Probably there is an error in some place.

I’m speaking about products for the Market, so it’s not possible to compile a special version for everyone - there should be a single production version for majority of users and without much overheads. I can not manage user’s computer memory and chart settings, so they are just some given external preconditions (equal for any number of buffers selected) and go out the scope of indicator development, especially taking into account that they (preconditions) can vary significantly.

I mentioned examples above: multicurrency or multiperiod indicators.

In addition, I don’t understand how a human can handle an indicator with 50+ or even 30 lines. Can you provide an example? This is where usability comes into play.

Well i have had products rejected from market due to stack overflow’s but i always found a solution re-writing the entire thing,

And usually end up ArrayResizing() to the needed number of cells, depending on the number of available instruments for any specific user.

That is very easy.


But you can’t change number of buffers dynamically. That’s the problem.

Apart from that, you can not resize indicator buffers, and stack overflow means problem in a control flow, not in a data.

You can use a lot of buffers just for calculations, they don’t have to be available to human user. A customer already asked what was the limit, that’s why I know it :slight_smile: