指标属性和函数间的连接

每个自定义指标都有很多属性, 有些是强制的,有些是开始描述的仓位,具有如下属性:

  • 窗口指示到绘图指示 – indicator_separate_window 或者 indicator_chart_window;
  • 指标缓冲区数量 – indicator_buffers;
  • 指标绘图数量 – indicator_plots。

也可以通过 预处理器 指令或者建立自定义指标的函数建立其他属性。这些属性和类似函数在如下表格中描述。

指标子窗口属性指令 IndicatorSet...()型函数 调整过的子窗口属性指令
indicator_height IndicatorSetInteger(INDICATOR_INDICATOR_HEIGHT, nHeight) 子窗口高度的修正值
indicator_minimum IndicatorSetDouble(INDICATOR_MINIMUM, dMaxValue) 纵轴最小值
indicator_maximum IndicatorSetDouble(INDICATOR_MAXIMUM, dMinValue) 纵轴最大值
indicator_levelN IndicatorSetDouble(INDICATOR_LEVELVALUE, N-1, nLevelValue) N水平面纵轴值
no preprocessor directive IndicatorSetString(INDICATOR_LEVELTEXT, N-1, sLevelName) 显示的水平面名称
indicator_levelcolor IndicatorSetInteger(INDICATOR_LEVELCOLOR, N-1, nLevelColor) N水平面颜色
indicator_levelwidth IndicatorSetInteger(INDICATOR_LEVELWIDTH, N-1, nLevelWidth) N平面的线宽
indicator_levelstyle IndicatorSetInteger(INDICATOR_LEVELSTYLE, N-1, nLevelStyle) N平面的线型
绘画属性指令 PlotIndexSet...() 型函数 调整过的绘画属性指令
indicator_labelN PlotIndexSetString(N-1,PLOT_LABEL,sLabel) 图N缩略名。当鼠标光标放在上面时显示在数据窗口和弹出提示框中
indicator_colorN PlotIndexSetInteger(N-1, PLOT_LINE_COLOR, nColor) 图N线的颜色
indicator_styleN PlotIndexSetInteger(N-1, PLOT_LINE_STYLE, nType) 图N的线型
indicator_typeN PlotIndexSetInteger(N-1, PLOT_DRAW_TYPE, nType) 图N的线种
indicator_widthN PlotIndexSetInteger(N-1, PLOT_LINE_WIDTH, nWidth) 图N的线宽
常用指标属性 IndicatorSet...()型函数 描述
无预处理器指令 IndicatorSetString(INDICATOR_SHORTNAME, sShortName) 设置显示在指标列表(在程序端按Ctrl+I打开)中的指标的便捷短名称。
无预处理器指令 IndicatorSetInteger(INDICATOR_DIGITS, nDigits) 设置指标值显示所需精确性-小数位的数量。
无预处理器指令 IndicatorSetInteger(INDICATOR_LEVELS, nLevels) 设置指标窗口平面数
indicator_applied_price 无函数,属性仅可以通过预处理器指令设置。 用于指标计算的默认价格类型。只有使用OnCalculate()时被指定。 属性值也可以在“参数”标签中“应用到”指标属性对话框中设置。

记录水平计算和预处理器项目绘图以1开始,而相同属性的技术使用函数以0开始,例如,少于1的指示值为#property。

有许多指令,没有类似函数:

指令 描述
indicator_chart_window 指标显示在主窗口中
indicator_separate_window 指标显示在独立子窗口中
indicator_buffers 所需指标缓冲区的数量
indicator_plots 指标中的平面图数量