等级: 免费版
- 注册:
- 2022-4-2
- 曾用名:
|

楼主 |
发表于 2024-4-19 21:44
|
显示全部楼层
请问老师,我那个出问题的子策略开仓代码如下,逐K计算,仅刷新最后一根K线模式有问题吗;
//***********************************//交易系统//***********************************//
variable:opensnum:=0,addsum:=0;
if date<>ref(date,1) then opensnum:=0;
if date<>ref(date,1) then addsum:=0;
todaykc:enterbars<=todaybar ;
//开平仓
if 开多条件 and opensnum<1 then
begin
sellshort(holding<0,holding,thisclose);
buy(holding=0,lots,thisclose);
opensnum:=1;
end
//
if 开空条件 and opensnum<1 then
begin
sell(holding>0,holding,thisclose);
buyshort(holding=0,lots,thisclose);
opensnum:=1;
end
补充内容 (2024-4-19 21:55):
这里是不是全局变量的申明以至于出现问题,有必要用全局变量吗 |
|