Skip to content

Commit

Permalink
0.8.22 fix bug (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Apr 8, 2022
1 parent a7bbb25 commit ac65dfe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions czsc/signals/ta.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,14 @@ def get_s_sma(c: analyze.CZSC, di: int = 1, t_seq=(5, 10, 20, 60)) -> OrderedDic
s[x1.key] = x1.value
s[x2.key] = x2.value

if len(c.bars_raw) < 100:
n = max(t_seq) + 10
if len(c.bars_raw) < n:
return s

if di == 1:
close = np.array([x.close for x in c.bars_raw[-100:]])
close = np.array([x.close for x in c.bars_raw[-n:]])
else:
close = np.array([x.close for x in c.bars_raw[-100-di+1:-di+1]])
close = np.array([x.close for x in c.bars_raw[-n-di+1:-di+1]])

for t in t_seq:
sma = SMA(close, timeperiod=t)
Expand Down

0 comments on commit ac65dfe

Please sign in to comment.