Skip to content

Commit 66fd379

Browse files
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

File tree

kline.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,22 +192,22 @@ def checkTrend(open,high,low,close):
192192
c=0
193193
d=0
194194
e=0
195-
195+
# 如果收盤價大於開盤價
196196
if close > open:
197+
# 長上引線
197198
if abs(high-close)>abs((open-close)*4):
198-
#print("長上引線")
199199
a=1
200+
# 長下引線
200201
if abs(open-low)>abs((open-close)*4):
201-
#print("長下引線")
202202
b=1
203+
# 如果收盤價小於開盤價
203204
if close < open:
204205
if abs(high-open)>abs((open-close)*4):
205-
#print("長上引線")
206+
# 長上引線
206207
a=1
207208
if abs(close-low)>abs((open-close)*4):
208-
#print("長下引線")
209+
# 長下引線
209210
b=1
210-
211211
# 不良標的會出現的狀況
212212
if (open == high) and (high == low) and (low == close):
213213
c=1
@@ -356,4 +356,4 @@ def dataClear():
356356
klineClose.clear()
357357
averagePrice.clear()
358358
priceRatio.clear()
359-
trendMarker.clear()
359+
trendMarker.clear()

0 commit comments

Comments
 (0)