[問題] hts 停損停利的語法問題

看板Option (期貨與選擇權)作者 (黃蜂)時間17年前 (2009/03/31 11:21), 編輯推噓3(305)
留言8則, 4人參與, 最新討論串1/1
我的做法是停損採取絕對點數的停損 但是停利的部分是採用突破高低點的方式 //停損 If MarketPosition = 1 Then OrderPrice =Entryprice(0)- value3 Exitlong ("XS") next Bar at OrderPrice Stop End if If MarketPosition = -1 Then OrderPrice = EntryPrice(0) + value3 ExitShort ("XB") next Bar at OrderPrice Stop End if //停利 If MarketPosition = 1 and value5<=r1 Then OrderPrice =highest(h,rday) Exitlong ("XS1") next Bar at OrderPrice limit End if If MarketPosition = -1 and value5<=r1 Then OrderPrice = lowest(l,rday) ExitShort ("XB1") next Bar at OrderPrice limit End if 但是不知道為什麼停利的部分好像都會有問題 有時候會停利但是有時候卻又沒有 不知道有沒有人可以幫忙確認一下 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.117.170.203 ywood:轉錄至看板 Trading 03/31 11:29

03/31 11:31, , 1F
阿政那邊有1篇,你可以用他的語法先測看看
03/31 11:31, 1F

03/31 12:37, , 2F
最高的h 最低的l 要指前一根的才行
03/31 12:37, 2F

03/31 20:58, , 3F
回樓上,用next bar不需一定要用前一根資料
03/31 20:58, 3F

03/31 20:59, , 4F
回原po,看起來沒問題,建議你用print資料出來找問題
03/31 20:59, 4F

03/31 21:01, , 5F
因為你用limit和stop,會不會是點位沒碰到?
03/31 21:01, 5F

03/31 22:30, , 6F
highest(h,time) 永遠都不會碰到 highest(h,t)[1]才有可能
03/31 22:30, 6F

04/01 00:13, , 7F
我覺得去程式版問比較容易找到答案~"~畢竟這裏不懂程式的人
04/01 00:13, 7F

04/01 00:13, , 8F
佔比較多~"~
04/01 00:13, 8F
文章代碼(AID): #19qOm_Pl (Option)
文章代碼(AID): #19qOm_Pl (Option)