MetaTrader:指标缓冲区数量少于需要

MetaTrader: indicator buffers amount is less than needed

我在 MetaTrader 中编译时遇到这个错误:

indicator buffers amount is less than needed

有什么帮助吗?

这似乎是一个问题:

#property indicator_buffers   XXX           //How Many Plots

XXX 应该是 Buffers/plots

的正确数量

MQL4 指标设置可能看起来像一个双头噩梦。
也许是,
也许不是:

指标设置有两种主要方法。

一个,使用#属性 ...语法接口, 和 另一个,使用函数调用...

这两个为什么存在?它们如何共存?

#property ...
indicator_chart_window                Show the indicator in the chart window
indicator_separate_window             Show the indicator in a separate window
indicator_height            int       Fixed height of the indicator subwindow in pixels (property INDICATOR_HEIGHT)
indicator_buffers           int       Number of buffers for indicator calculation
indicator_minimum           double    The bottom scaling limit for a separate indicator window
indicator_maximum           double    The top scaling limit for a separate indicator window
indicator_labelN            string    Sets a label for the N-th graphic series displayed in DataWindow
indicator_colorN            color     The color for displaying line N, where N is the number of graphic series; numbering starts from 1
indicator_widthN            int       Line thickness in graphic series, where N is the number of graphic series; numbering starts from 1
indicator_styleN            int       Line style in graphic series, specified by the values of ENUM_LINE_STYLE. N is the number of graphic series; numbering starts from 1
indicator_typeN             int       Type of indicator drawing style. N is the number of graphic series; numbering starts from 1
indicator_levelN            double    Horizontal level of N in a separate indicator window
indicator_levelcolor        color     Color of horizontal levels of the indicator
indicator_levelwidth        int       Thickness of horizontal levels of the indicator
indicator_levelstyle        int       Style of horizontal levels of the indicator

在使用 MQL4 一段时间后,您将采用自己最好的方式前进。


为什么工作失败?

简短版本:编译时决定设置为指标时间序列对齐数据预设的数组数量。超过这个设定的上限则必须抛出异常,因为没有进一步的缓冲区来存储数据。

但是,先设置一个更大的上限是可能的,并且可能有助于在以后的某个时间仍然 space 足够,即使您现在不使用它也是如此。