COCO研究院

 找回密碼
 註冊
搜索
查看: 2400|回復: 0

[其他程式語言] HTS選擇權輸出字串

[複製鏈接]
發表於 16-7-21 23:36 | 顯示全部樓層 |閱讀模式

各位大大  晚安

   小弟的下單機有選擇須輸出下面的字串,如果只做買進策略,不知下面的程式碼邏輯上是否正確?謝謝!

n選擇權:SymName,SymID,Month,StrPrice,CallPut,NewClose#DateTime,Current,Price
n                名稱     代號   份    履約價  C:買權  A:自動
n                                                                             P:賣權  N:新倉
n                                                                                                C:平倉  
範例:台指權,TXO,2010/5,7800,P,C#2010/05/0210:35:04,-10,24.5
買進買權
if date = lastcalcdate and time = LastCalcTime and entrytype(0)=1 then
   FileDelete("R:\選擇權.txt")
   FileAppend("R:\選擇權.txt", "台指選"+",""TXO"+",""2016/7"+",""8900"+",""C"+",""N#"+cdate(D)+" "+ctime(Q_time)+","+NumToStr(CurrentContracts,0)+","+NumToStr(close,0))

end if
買進買權平倉
if date = lastcalcdate and time = LastCalcTime and entrytype(1)=1 and entrytype(0)=0 then
   FileDelete("R:\選擇權.txt")
   FileAppend("R:\選擇權.txt", "台指選"+",""TXO"+",""2016/7"+",""8900"+",""C"+",""C#"+cdate(D)+" "+ctime(Q_time)+","+NumToStr(CurrentContracts,0)+","+NumToStr(close,0))

end if
買進賣權
if date = lastcalcdate and time = LastCalcTime and entrytype(0)=-1 then
   FileDelete("R:\選擇權.txt")
   FileAppend("R:\選擇權.txt", "台指選"+",""TXO"+",""2016/7"+",""8900"+",""P"+",""N#"+cdate(D)+" "+ctime(Q_time)+","+NumToStr(CurrentContracts,0)+","+NumToStr(close,0))

end if
買進賣權平倉
if date = lastcalcdate and time = LastCalcTime and entrytype(1)=-1 and entrytype(0)=0 then
   FileDelete("R:\選擇權.txt")
   FileAppend("R:\選擇權.txt", "台指選"+",""TXO"+",""2016/7"+",""8900"+",""P"+",""C#"+cdate(D)+" "+ctime(Q_time)+","+NumToStr(CurrentContracts,0)+","+NumToStr(close,0))

end if


您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-6-15 15:46

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |