Type/to search
8
Follow
0
Followers
PythonでKAMAインジケーターを呼び出す際のエラーについて助けを求める
Help
Created 2021-11-19 23:17:10  Updated 2021-11-20 09:10:32
 4
 1088

import talib
def main():
LastBarTime = 0
while(true):
records = exchange.GetRecords()
BarTime = records[-1]["Time"]
ext.PlotRecords(records, " ")
if LastBarTime != BarTime:
kama = talib.KAMA(records, 30)
Log(kama[30])
Log(kama[kama.length-1])
LastBarTime = BarTime
KAMA指標を試してみると,JSで実行できるが,pyで誤りが出ます. <unk>line 9, in main TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got OOO00) <unk> これは。どう修正するか教えて下さい。

カーマイン指数で表すのは, カーマイン指数で表すのは, カーマイン指数です.
方向 (DIR) = 終値 - n 日前の終値
ボラティリティ (VIR) = sum(abs(終値 - 前取引日の終値), n)
効率性(ER)=方向/ボラティリティ
速い = 2 / (n1 + 1)
遅い = 2 / (n2 + 1)
滑らかさ(CS) = 効率 * (速い - 遅い) + 遅い
係数(CQ) = 平滑化 * 平滑化
KAMA = 指数加重平均 ((動的移動平均 ((閉盘価格,系数),2) (この最後のステップは,説明書に記載されているこの計算法による:現在のKAMA = 前回のKAMA + SC x (Price - 前回のKAMA))

長い時間をかけて,最後のステップの<unk>の前のKAMA<unk>がどこから来たのかを見ることができなかったので,最初のKAMA値を計算するときに,その前のKAMA値は存在しなかったのでしょうか? 私のアルゴリズムは間違っていたのでしょうか?
村の村長が,村の村長に,村の村長に,村の村長に,村の村長に,

Related Recommendations
Comment
All comments (4)

    talib.KAMA(records.Close,30)
    FMZ API文档上有Python调用的例子。
    img

    5 years ago

    可以了,谢谢梦总。还想请教一下,这个传入的参数也是一个数组么?如果我自己定义一个数组作为参数,也可以计算KAMA么?
    为啥是写成records.Close,不用带下标么?比如records[i].Close。求指点,谢谢!

    5 years ago

    把数据构造成函数要求的参数即可。报错信息上提示的:expected numpy.ndarray,

    5 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)