小幫手你好,
今天學到了一個函數print能把變數每次執行的結果逐行列印在文字檔
我把一些腳本範例加上無數個printf, 然後查看每根bar數據的變化
對於釐清XS語法邏輯觀念幫助不少
但是這一段腳本不知道為什麼我就只是複製後加入警示腳本,選日線回測
無論跑什麼商品什麼日期都不會有結果,也不會有print檔案
這裡腳本宣告註明需逐筆洗價,
但是在回測環境不是至少每天有 270筆分K的資料來逐筆洗價嗎?
還是說q_tickvolume這種逐筆的函數不能用在回測?
如果需要改要怎麼改?
input: atVolume(100,"大單門檻");
input: LaTime(10,"大單筆數");
input:TXT("須逐筆洗價","使用限制");
settotalbar(3);
variable: intrabarpersist Xtime(0);
//計數器
variable: intrabarpersist Volumestamp(0);
Volumestamp =q_DailyVolume;
if Date> date[1] or
Volumestamp = Volumestamp[1]
then Xtime =0; //開盤那根要歸0次數
if q_tickvolume > atVolume
//單筆tick成交量超過大單門檻
and GetQuote("BidAskFlag")=1
//外盤成交
then Xtime+=1;
//量夠大就加1次
if Xtime > LaTime
and close>close[1]*1.01
then
begin
ret=1;
Xtime=0;
end;
1 評論