以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 老师请问当根K线收盘价大于开盘价就开多,如果开多后来不及平多价格已经跌破开盘价就反手开空,反之开空也是如此,请问如何编写模型,谢谢。 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=64731) |
||||||||||||
-- 作者:sx -- 发布时间:2014/5/7 11:14:43 -- 老师请问当根K线收盘价大于开盘价就开多,如果开多后来不及平多价格已经跌破开盘价就反手开空,反之开空也是如此,请问如何编写模型,谢谢。 老师请问当根K线收盘价大于开盘价就开多,如果开多后来不及平多价格已经跌破开盘价就反手开空,反之开空也是如此,请问如何编写模型,谢谢。 |
||||||||||||
-- 作者:jinzhe -- 发布时间:2014/5/7 11:26:12 -- 如果是走完k线下单模式那么就这样写 if c>o then buy......; if holding>0 and close<enterprice then begin sell........; buyshort......; end
if c<o then buyshort.......; if holding<0 and close>enterprice then begin sellshort.........; buy......; end
如果是固定时间间隔模式那么就这样写
if h>o then buy......; if holding>0 and l<enterprice then begin sell........; buyshort......; end
if l<o then buyshort.......; if holding<0 and h>enterprice then begin sellshort.........; buy......; end |
||||||||||||
-- 作者:sx -- 发布时间:2014/5/7 11:39:10 -- 老师,buy......;如何定义,谢谢。 |
||||||||||||
-- 作者:qq代人发帖 -- 发布时间:2014/5/7 12:46:38 --
|
||||||||||||
-- 作者:sx -- 发布时间:2014/5/7 14:15:16 -- 老师,模型不会反手,谢谢。 |
||||||||||||
-- 作者:jinzhe -- 发布时间:2014/5/7 14:20:01 -- 这个不会,贴上你的代码 |
||||||||||||
-- 作者:sx -- 发布时间:2014/5/7 14:27:48 -- if h>o then buy(C>O ,1000,THISCLOSE); if holding>0 and l<enterprice then begin sell(C<O ,1000,THISCLOSE); buyshort(C<O ,1000,THISCLOSE); end; if l<o then buyshort(C<O ,1000,THISCLOSE); if holding<0 and h>enterprice then begin sellshort(C>O ,1000,THISCLOSE); buy(C>O ,1000,THISCLOSE); end; |
||||||||||||
-- 作者:qq代人发帖 -- 发布时间:2014/5/7 14:44:40 -- 您这种是选用2楼固定轮询的写法,为什么又掺杂了走完K的(c>o,c<o), 我把它换成了holding=0,holding<0,holding>0的判断 平多后立马开空 或平空后立马开多就叫反手 if h>o then buy(holding=0 ,1000,THISCLOSE); if holding>0 and l<enterprice then begin buyshort(holding=0 ,1000,THISCLOSE);//反手开空 end; if holding<0 and h>enterprice then begin sellshort(holding<0 ,1000,THISCLOSE);//平空 buy(holding=0 ,1000,THISCLOSE);//反手开多 end;
|
||||||||||||
-- 作者:sx -- 发布时间:2014/5/7 15:11:57 -- 老师我的意思是每一根k线都要有信号,谢谢。 比如当根K线开盘上涨做多,下一根K线如果继续上涨还是做多直至有一根K线下跌就反手做空。 |
||||||||||||
-- 作者:qq代人发帖 -- 发布时间:2014/5/7 15:58:10 -- 把holding持仓判断换成1,只有if 条件成立 就会开平仓,每根k都有信号 if h>o then buy(1,1000,THISCLOSE); if holding>0 and l<enterprice then begin
buyshort(1 ,1000,THISCLOSE);//反手开空 end;
if holding<0 and h>enterprice then begin sellshort(1 ,1000,THISCLOSE);//平空 buy(1,1000,THISCLOSE);//反手开多 end; |