I get this error on compilation in MetaTrader:
indicator buffers amount is less than needed
any help?
There are two principal methods used for an Indicator setup.
one, using #property ... syntax interface, and another, using function calls ...
Why these two exist? How do they co-exist?
#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
After some time in MQL4 you will adopt your own best way to go forwards.
Short version: a compile-time decision sets the amount of arrays preset for indicator time-series aligned data. Going past this set ceiling then must throw an exception as there is no further buffer to store data in.
However, setting a much bigger ceiling first is possible and may help, somewhere at a later time, to have still space enough, even when you do not use it right now.