TB公式的编程官方教程3.docVIP

  • 69
  • 0
  • 约1.76万字
  • 约 27页
  • 2017-03-05 发布于湖北
  • 举报
TB公式的编程官方教程3

九、用户函数编写 9-1、TB用户函数的编写 以求平均值(例6)和极值(例7)为例 例6:这是求平均值的内建用户函数,其中就调用了summation函数 Params NumericSeries Price(1); Numeric Length(10); Vars Numeric AvgValue; Begin AvgValue = Summation(Price, Length) / Length; Return AvgValue; End 例7:求极值 Sample10:这是求极值的内建用户函数,其中就用到了引用参数 Params NumericSeries Price(1); Numeric Length(10); Bool bMax(True); NumericRef ExtremeBar; Vars NumericSeries MyVal; NumericSeries MyBar; Numeric i; Begin MyVal = Price; MyBar = 0; If ( CurrentBar = Length - 1 || MyBar[1] == Length - 1) { for i = 1 to Length - 1 { If (bMax ){ If ( Price[i] MyVal) { MyVal = P

文档评论(0)

1亿VIP精品文档

相关文档