以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 帮忙写一个策略 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=146012) |
-- 作者:allen23 -- 发布时间:2017/1/5 23:32:26 -- 帮忙写一个策略 请问一下 5分钟图上的策略 1、今天开盘价比昨日收盘价低就做空,高就做多; 2、止损止盈都是1个百分点; 3、每天只做一单; 请问怎么编写 谢谢! |
-- 作者:jinzhe -- 发布时间:2017/1/6 8:52:02 -- variable:bj=0;
cc:=ref(close,todaybar);
if todaybar=1 and holding=0 and bj=0 and o>cc then begin buy(1,1,marketr); bj:=1; end
if todaybar=1 and holding=0 and bj=0 and o<cc then begin buyshort(1,1,marketr); bj:=1; end
if holding>0 and c>enterprice*1.01 and enterbars>0 then sell(1,0,marketr);
if holding>0 and c<enterprice*0.99 and enterbars>0 then sell(1,0,marketr);
if holding<0 and c>enterprice*1.01 and enterbars>0 then sellshort(1,0,marketr);
if holding<0 and c<enterprice*0.99 and enterbars>0 then sellshort(1,0,marketr);
if time =closetime(0) then bj:=0; |
-- 作者:allen23 -- 发布时间:2017/1/6 13:55:11 -- 谢谢! 问一下, buy(1,1,marketr)中,第二个1是表示1手吧?那第一个1什么意思? |
-- 作者:jinzhe -- 发布时间:2017/1/6 14:03:08 -- 表示条件恒成立,因为外面的if写了条件,这里写1是省略写条件 |
-- 作者:allen23 -- 发布时间:2017/1/6 14:13:57 -- 加入收盘平仓的条件,怎么加? |
-- 作者:jinzhe -- 发布时间:2017/1/6 14:20:56 -- if time=closetime(0) then begin sell(1,0,marketr); sellshort(1,0,marketr); end |