等级: 免费版
- 注册:
- 2021-9-28
- 曾用名:
|
本帖最后由 技术006 于 2022-6-7 09:18 编辑
WARNING_DISABLE:4; //close the extgbdata function warning...
if BARPOS = 1 THEN
BEGIN
EXTGBDATASET('totalst',0);
END;
if time =150000 and EXTGBDATA('totalst') > 0 THEN
BEGIN
MSGOUT(1,STKLABEL+',date:'+NUMTOSTR(date+19000000,0)+'time:'+numtostr(time,0)+'totalst is more than 0..come in and it is:'+NUMTOSTR(EXTGBDATA('totalst'),0));
EXTGBDATASET('totalst',0);
MSGOUT(1,STKLABEL+',date:'+NUMTOSTR(date+19000000,0)+'time:'+numtostr(time,0)+'totalst is inited at ='+NUMTOSTR(EXTGBDATA('totalst'),0));
END;
if time=140000 THEN
begin
EXTGBDATASET('totalst',EXTGBDATA('totalst') + 1);
test_v1:= EXTGBDATA('totalst');
MSGOUT(1,STKLABEL&'140000..tst..date:'+NUMTOSTR(date+19000000,0)+'time:'+numtostr(time,0)+',close='+NUMTOSTR(close,2)+',totalst count:'+ NUMTOSTR(test_v1,0) );
end;
上述策略进行多品种股票回测:
回测时间为1分钟周期,时间从:2022/5/10至 2022/6/2日,每品种投20万,测试逻辑应该是:该策略从2022-5-10日的9点31份开始,依次对上述14个品种进行测试,此时:totalst 外部全局变量 会依次 在 每天的 140000进行加1,如果14个品种依次运行应为14的值,然后到150000时候会对 totalst 变量清零。然后第二交易日2022/5/11日 有重复。但金字塔实际结果却是:当140000分时不能对每一个品种运行 计数,而是 单独对每一个品种比如000078(海王生物)就从5月10日至6月2日进行每天计数,自然就是1,然后150000清零,问题:如何解决横截面时间比如140000对美元加载品种进行计数(利用extgbdata变量)?
输出结果:
2022/06/06 17:24:04 000078140000..tst..date:20220510time:140000,close=3.34,totalst count:1
2022/06/06 17:24:04 000078,date:20220510time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220510time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220511time:140000,close=3.52,totalst count:1
2022/06/06 17:24:04 000078,date:20220511time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220511time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220512time:140000,close=3.56,totalst count:1
2022/06/06 17:24:04 000078,date:20220512time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220512time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220513time:140000,close=3.75,totalst count:1
2022/06/06 17:24:04 000078,date:20220513time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220513time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220516time:140000,close=3.97,totalst count:1
2022/06/06 17:24:04 000078,date:20220516time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220516time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220517time:140000,close=3.54,totalst count:1
2022/06/06 17:24:04 000078,date:20220517time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220517time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220518time:140000,close=3.61,totalst count:1
2022/06/06 17:24:04 000078,date:20220518time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220518time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220519time:140000,close=3.77,totalst count:1
2022/06/06 17:24:04 000078,date:20220519time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220519time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220520time:140000,close=3.76,totalst count:1
2022/06/06 17:24:04 000078,date:20220520time:150000totalst is more than 0..come in and it is:1
2022/06/06 17:24:04 000078,date:20220520time:150000totalst is inited at =0
2022/06/06 17:24:04 000078140000..tst..date:20220523time:140000,close=3.79,totalst count:1
|
|