以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- [求助]请求可以用于历史评测的指定价位交易写法,谢谢! (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=56033) |
-- 作者:自渔自乐 -- 发布时间:2013/8/31 16:56:42 -- [求助]请求可以用于历史评测的指定价位交易写法,谢谢! 开仓:当日价格触及昨日最低价,则以这个最低价的价位买入 平仓:当日价格触及上周最高价,则以这个最高价的价位卖出 要求能以上述指定的价位历史评测,谢谢帮助~
|
-- 作者:自渔自乐 -- 发布时间:2013/8/31 17:15:26 -- 是隔日交易,非日内交易 只想学一下可以历史评测的指定价位的正确写法,谢谢帮助!
|
-- 作者:qwer123 -- 发布时间:2013/9/1 14:17:46 -- r1:=callstock(\'if00\',vthigh,6,-1); r2:=callstock(\'if00\',vtlow,6,-1); if c>=r1 then begin sellshort(holding<0,1,limitr,r1); buy(holding=0,1,limitr,r1); end if c<=r2 then begin sell(holding>0,0,limitr,r2); buyshort(holding=0,1,limitr,r2); end |
-- 作者:qwer123 -- 发布时间:2013/9/1 14:53:29 -- 不好意思写错了,为了补偿我的过失给你一个完整的。 //股指期货自动交易程序(2分钟日内趋势交易系统)(16号系统) //编制: //日期:2013。 //修改记录: //======================================================== //交易控制变量 variable:cs1=1; variable:cs2=1; //********************************** //交易手数: tn:=1; //最大持仓量 cx:=1; //提前下单量(秒) xd:=3; //交易时间区间 p1:=time>=091500 and time<=151000; p2:=if(islastbar,dynainfo(207),time); p3:=time0-timetot0(p2),linethick0; //******************************** r1:=barslast(date<>ref(date,1)); r2:=ref(o,r1); partline(r1>0,r2); //******************************** hd:=if(islastbar,3,1.2); hd1:=if(islastbar,3,0.2); //******************************** r11:callstock(\'if00\',vthigh,6,-1); r12:callstock(\'if00\',vtlow,6,-1); if h>=r11 and p1 then begin sellshort(holding<0,0,limitr,max(r11,o)+hd); buy(holding=0,1,limitr,max(r11,o)+hd); end if l<=r12 and p1 then begin sell(holding>0,0,limitr,min(r12,o)-hd); buyshort(holding=0,1,limitr,min(r12,o)-hd); end //******************************** //收盘前清仓 if p2>=151158 then begin //sellshort(holding<0,abs(holding),limitr,c+hd1); //sell(holding>0,holding,limitr,c-hd1); end 交易总数:totaltrade,colorwhite,linethick0; 盈亏:asset-1000000,colorred,linethick1,noaxis; 日盈亏:asset-ref(asset,r1+1),noaxis,colorred,linethick0; 持仓:holding,colorwhite,linethick0; rr1:=barslast(month<>ref(month,1)); 月盈利:asset-ref(asset,rr1+1),coloryellow,linethick0; variable:hc=0; 回撤:hhv(盈亏,3000)-盈亏,linethick0,coloryellow; if 回撤>hc then hc:=回撤; 最大回撤:hc,coloryellow,linethick0; [此贴子已经被作者于2013/9/1 14:54:23编辑过]
|
-- 作者:自渔自乐 -- 发布时间:2013/9/1 15:50:09 -- 感谢qwer123老师,我好好学习 sell(holding>0,0,limitr,r1);{r1为指定卖价} buyshort(holding=0,1,limitr,r2);{r1为指定买价} |