Closed dalalkrish closed 3 years ago
I solved it. For anyone, who wants to do it in Python
:
counter = 0
result = []
window_begin_idx=0; window_end_idx=0; window_middle_idx=0; min_idx=0; max_idx=0;
number=0.0; mins=10000.0; maxs=0.0
while counter < len(closing_price):
if counter > window_size:
window_begin_idx = counter - window_size
window_end_idx = window_begin_idx + window_size - 1
window_middle_idx = (window_begin_idx + window_end_idx)//2
for i in range(window_begin_idx, window_end_idx+1):
number = closing_price[i]
if number < mins:
mins=number
min_idx = np.where(closing_price==mins)[0][0]
if number > maxs:
maxs=number
max_idx = np.where(closing_price==maxs)[0][0]
if max_idx == window_middle_idx:
result.append("SELL")
elif min_idx == window_middle_idx:
result.append("BUY")
else:
result.append("HOLD")
mins = 10000.0
maxs = 0.0
counter+=1
Hi Omer,
Congratulations on this paper. I thoroughly enjoyed reading it. I'm trying to implement it but I'm struggling with generating
BUY
,SELL
, andHOLD
labels. I tried reading through your JAVA code and tried to tweak my code as much as possible but I'm not a JAVA person. Can you please suggest what am I doing wrong? My implementation only produces theHOLD
label. I very much appreciate your help.My implementation: