小幫手您好,我寫了一個指標來標示近5日每天的最高價與最低價,假如價格超出個股今天的漲跌停範圍就不顯示。但我這個寫法好像有點土法煉鋼,而且要增減天數也很不方便。請問您有沒有什麼方法可以優化這個指標呢?
if highD(1) <= closeD(1)*1.1 and highD(1) >= closeD(1)*0.9 and Date=currentDate then plot1(highD(1),"前1天最高價"); if highD(2) <= closeD(1)*1.1 and highD(2) >= closeD(1)*0.9 and Date=currentDate then plot2(highD(2),"前2天最高價"); if highD(3) <= closeD(1)*1.1 and highD(3) >= closeD(1)*0.9 and Date=currentDate then plot3(highD(3),"前3天最高價"); if highD(4) <= closeD(1)*1.1 and highD(4) >= closeD(1)*0.9 and Date=currentDate then plot4(highD(4),"前4天最高價"); if highD(5) <= closeD(1)*1.1 and highD(5) >= closeD(1)*0.9 and Date=currentDate then plot5(highD(5),"前5天最高價"); if lowD(1) <= closeD(1)*1.1 and lowD(1) >= closeD(1)*0.9 and Date=currentDate then plot6(lowD(1),"前1天最低價"); if lowD(2) <= closeD(1)*1.1 and lowD(2) >= closeD(1)*0.9 and Date=currentDate then plot7(lowD(2),"前2天最低價"); if lowD(3) <= closeD(1)*1.1 and lowD(3) >= closeD(1)*0.9 and Date=currentDate then plot8(lowD(3),"前3天最低價"); if lowD(4) <= closeD(1)*1.1 and lowD(4) >= closeD(1)*0.9 and Date=currentDate then plot9(lowD(4),"前4天最低價"); if lowD(5) <= closeD(1)*1.1 and lowD(5) >= closeD(1)*0.9 and Date=currentDate then plot10(lowD(5),"前5天最低價");
1 評論