看板 Trading 關於我們 聯絡資訊
請問各位大大 小弟剛剛接觸EasyLanguage 想寫個小程式來試試TS的flow 下列程式片段的目的很簡單 就是挑一個weekday(例如星期四)開盤買 收盤賣 if date >= BEGIN_DAY and date <= END_DAY then begin if DayofWeek(date+1)=4 then Buy ("W") Next Bar at Open; if DayofWeek(date)=4 then Exitlong this bar on close; End; 可是有時候星期四沒開盤(星期三五有) 她就會建倉於星期五 我知道是這行出問題 if DayofWeek(date+1)=4 then Buy ("W") Next Bar at Open; 請問該怎麼改寫呢? 謝謝~~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.31.32.184
tedinroc:很簡單啊,再加一個條件式設定星期五不要進場... 11/10 18:53
khchueh:萬一四五都沒開盤, 他會建倉於星期一(有開盤) 11/10 19:05
khchueh:簡單說就是 Next Bar at Open的問題 11/10 19:07
tedinroc:如果你只要星期四進場就其它都設不要進場啊 = =" 11/10 19:17
khchueh:新手咩~~請舉例 感恩喔~~ 11/10 19:40
newred:我猜可以在at open 加入 else currentcontracts<>0 ; 11/10 21:54
newred:不確定 手邊沒有TS 可以幫你試 但是邏輯就是(else 保持1口) 11/10 21:56
khchueh:先謝囉~~試過了, TS verify不會過~~ 11/10 22:13
newred:可以查一下裡面的字典 有關於口數的部分 現在我幫不上忙= = 11/10 23:56
khchueh:查過還是不太懂, 請newred大大方便的話幫我試一下囉~~ 11/11 00:06
newred:那應該要明天吧 因為我人在外面 樂意試試看 11/11 00:07