请问:这个怎样写?开仓是走完K线,强平不用走完k线。
价格跌破30均线,多单全部强平。
价格突破30均线,空单全部强平。
平仓语句倒是简单。
ma30:ma(c,30);
sell(cross(ma30,c),holding,market);
sellshort(cross(c,ma30),holding,market);
重点是这个
走完K线与固定轮训模式共存:http://www.weistock.com/bbs/dispbbs.asp?boardid=10&Id=151891
所以你需要额外处理下开仓的条件。从原先的条件A,变成ref(a,1)就行了。
这个不能通过测评??
marketr 交易系统函数的第三参数必须为交易控制符
if [c<hh-20*mindiff and holding>0 then sell(1,holding,marketr)]or [sell(cross(ma180,h),holding,market)];
if [c>ll+20*mindiff and holding<0 then sellshort(1,holding,marketr)]or[ sellshort(cross(h,ma180),holding,market)];
[]括号是不能使用的。
然后你这里用or是干嘛的
if [c<hh-20*mindiff and holding>0 then sell(1,holding,marketr)]or [sell(cross(ma180,h),holding,market)];
你不能把平仓语句用or连接啊。这即不规范,也没有实际效果。
你要这样一句句分开写。
if c<hh-20*mindiff and holding>0 then sell(1,holding,marketr);
或者这样把条件合并在一起
if (c<hh-20*mindiff and holding>0) or (cross(ma180,h)) then sell(1,holding,marketr);
只要两个平仓条件,其中一个成立,就达到平仓效果
[c<hh-20*mindiff and holding>0 then sell(1,holding,marketr)]这是移动止损 or 这是或者的意思 [sell(cross(ma180,h),holding,market)]这是强平;
参考5楼的回复。我知道你的意思,但是你原先的写法是不规范的。要么分开写,要么在条件的地方使用or连接。