HTS選擇權輸出字串
各位大大晚安
小弟的下單機有選擇須輸出下面的字串,如果只做買進策略,不知下面的程式碼邏輯上是否正確?謝謝!
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
頁:
[1]