不知怎样将日内模型中的时间和止损部份删除,我想用非日内模型来测试历吏收益。但自己又不懂金字塔编程,试着将前面的两行时间删除掉后,但后面的语句又通不过。因此,特向论坛中的高手求助。谢谢!
|
公式如下(将日内模型中的时间和止损部份删除):
time1:= time>090300 and time<112700 or (time>133300 and time<145700);
time:= time> 112700 and time<113000 or (time>145700 and time<150000);
if c>均线 and time1 then begin
sellshort();
buy();
end//价在均线上平空开多
if c<均线 and time1 then begin
sell();
buyshort();
end//价在均线下平多开空
if c<0.99*enterprice and holding>0 then sell();//1%多头止损
if c>enterprice*1.01 and holding<0 then sellshort();//1%空头止损
if time2 then begin//收盘前平仓
sell();
sellshort();
end
if c>均线 then begin
sellshort();
buy();
end//价在均线上平空开多
if c<均线 and begin
sell();
buyshort();
end//价在均线下平多开空
if time>145900 then begin//收盘前平仓
sell();
sellshort();
end
不知为何公式测试通不过?文字提示为: 函数 所调用的参数与预定义参数不符。
请再帮我测试通过一下。
另外,收盘前平仓部份可以直接删除吗?
谢谢!
均线:=ma(c,M);
if c>均线 then begin
sellshort();
buy();
end//价在均线上平空开多
if c<均线 and begin
sell();
buyshort();
end//价在均线下平多开空
if time>145900 then begin//收盘前平仓
sell();
sellshort();
end
我只是将均线参数设置为M: 即为: 均线:=ma(c,M);
以下这两个()号里都是需要填上均线参数M 吗?我不懂编程,请老师尽量帮我说明白一些。谢谢! sellshort(); buy(); |
另外, 建议论坛固定贴出一些简单常用的模型编程范例,以方便新手看样照葫芦画瓢。同时也可减少客服的工作量。
模型范例可以参考阿火的秘籍
http://www.weistock.com/bbs/dispbbs.asp?boardid=10&Id=9439
如果对公式不是很熟练,可以先进行学习
http://www.weistock.com/bbs/dispbbs.asp?boardid=2&Id=370
我将()内填入M(均线参数),但公式测评仍然通不过? 文字提示为: if 语句缺少 THEN
请帮我设置后并请测试下看是否正常。谢谢!
公式如下:
均线:=ma(M);
if c>均线 then begin
sellshort(M);
buy(M);
end//价在均线上平空开多
if c<均线 and begin
sell(M);
buyshort(M);
end//价在均线下平多开空
//if time>145900 then begin // 需将收盘前平仓条件删除。
//sell(M);
//sellshort(M);
//end
我现在只需要 价在60日均价线之上平空开多,价在60日均价线之下平多开空,亏损20%强行平仓。谢谢!