Commit 66fd379
authored
更改 checkTrend() 函式的部分註解與排版
# 檢測為多頭或空頭
def checkTrend(open,high,low,close):
try:
a=0
b=0
c=0
d=0
e=0
# 如果收盤價大於開盤價
if close > open:
# 長上引線
if abs(high-close)>abs((open-close)*4):
a=1
# 長下引線
if abs(open-low)>abs((open-close)*4):
b=1
# 如果收盤價小於開盤價
if close < open:
if abs(high-open)>abs((open-close)*4):
# 長上引線
a=1
if abs(close-low)>abs((open-close)*4):
# 長下引線
b=1
# 不良標的會出現的狀況
if (open == high) and (high == low) and (low == close):
c=1
# 十字線
if a==1 and b==1 :
c=1
# 多頭收線
if (close > open and a!=1) or b==1:
d=1
# 空頭收線
if (close < open and b!=1) or a==1:
e=1
# 適合做空
if ((a==1 or e==1) and c==0):
trendType.append("空頭")
return 0
# 適合做多
if ((b==1 or d==1) and c==0):
trendType.append("多頭")
return 1
# 十字線
if(c==1):
trendType.append("十字線")
return None
except:
print("檢測多空頭錯誤")1 parent d2e1875 commit 66fd379
1 file changed
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
| 197 | + | |
197 | 198 | | |
198 | | - | |
199 | 199 | | |
| 200 | + | |
200 | 201 | | |
201 | | - | |
202 | 202 | | |
| 203 | + | |
203 | 204 | | |
204 | 205 | | |
205 | | - | |
| 206 | + | |
206 | 207 | | |
207 | 208 | | |
208 | | - | |
| 209 | + | |
209 | 210 | | |
210 | | - | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
0 commit comments