请教老师一下,在公式交易模型中,是否可以实现“当日交易截止9:50分,如果当日的交易(日内交易)账户资产是亏损的,那么今天后面交易只要出现今日账户总盈利200元即清仓,当天不在开仓交易”?
请老师帮忙想法编写一下,谢谢了!
如果要判断实际资金的话,那么就需要用到专业版了,标准版不太好弄
如果用虚拟资金,可以这么写:
variable:yl=0;
variable:bj=0;
if valuewhen(time=135000,asset-ref(asset,todaybar)<0) then yl:=1;
if asset-ref(asset,todaybar)>200 and time>135000 and holding<>0 then begin
sellshort(1,0,market);
sell(1,0,market);
bj:=1;
end
if time=closetime(0) then bj:=0;
开仓条件加入bj=0;
谢谢jinzhe老师!!
请老师再帮忙加上一个条件:当日交易(日内交易)只要今日账户总盈大于5000元,立即平仓,当日不在开仓交易。。
再次麻烦老师了!~在此深表感谢!敬礼!!
前面已经盈利200清仓不交易了,再设置一个盈利5000清仓不交易没意义了吧
variable:yl=0;
variable:bj=0;
if valuewhen(time=135000,asset-ref(asset,todaybar)<0) then yl:=1;
if asset-ref(asset,todaybar)>200 and time>135000 and holding<>0 then begin
sellshort(1,0,market);
sell(1,0,market);
bj:=1;
end
if asset-ref(asset,todaybar)>5000 then begin
sell(1,0,market);
sell(1,0,market);
bj:=1;
end
if time=closetime(0) then bj:=0;
开仓条件加入bj=0;
老师,刚才我做恒指模拟账户盈利近6000元,账户也没自动平仓。。
我在最开始就讲过了
"如果要判断实际资金的话,那么就需要用到专业版了,标准版不太好弄
如果用虚拟资金,可以这么写:"
也就是我写的就不是给你判断帐号资金用的,判断是交易指标所产生的虚拟资金和虚拟盈利