【发布时间】:2015-07-27 11:57:47
【问题描述】:
我是 pandas 的新手,我需要一个计算慢速随机变量的函数。我认为应该可以轻松实现,但我对 pandas 中的高级 API 不熟悉。
我的数据框包含“开盘价”、“高价”、“低价”和“收盘价”,并按日期编制索引。这么多信息应该足以计算慢随机数。
Following is the formula for calculating Slow Stochastic:
%K = 100[(C - L14)/(H14 - L14)]
C = the most recent closing price
L14 = the low of the 14 previous trading sessions
H14 = the highest price traded during the same 14-day period.
%D = 3-period moving average of %K
【问题讨论】:
标签: numpy pandas matplotlib