以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请教个策略编写问题  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=51793)

--  作者:just1
--  发布时间:2013/5/8 15:17:10
--  请教个策略编写问题
So.J  15:14:15
请教个策略编写问题
A,B两条均线 
在A上穿B后5个周期内 出现A下穿B时 开空 20个点止盈,5个点止损
在A下穿B后5个周期内 出现A上穿B时 开多 20个点止盈,5个点止损

--  作者:jinzhe
--  发布时间:2013/5/8 15:20:11
--  
反过来思考,在a下穿b的时候,判断之前5个周期是否存在a上穿b,这个会写吗?
--  作者:jj_king
--  发布时间:2013/5/8 16:09:05
--  
A:=cross(均线1,均线2);
B:=cross(均线2,均线1);
AA:=barslast(A);
BB:=barslast(B);
if A=1 and AA<5 then buy(1,1,market);
if B=1 and BB<5 then buyshort(1,1,market);

if holding>0 and enterprice-c>5*mindiff then sell(1,0,market);
if holding>0 and c-enterprice>20*mindiff then sell(1,0,market);
if holding<0 and enterprice-c>20*mindiff then sellshort(1,0,market);
if holding<0 and c-enterprice>5*mindiff then sellshort(1,0,market);
[此贴子已经被作者于2013-5-8 16:10:54编辑过]

--  作者:jj_king
--  发布时间:2013/5/8 16:11:56
--  
请问这么写是错在哪里了?
--  作者:jinzhe
--  发布时间:2013/5/8 16:20:48
--  

a=1 and bb<5

b=1 and aa<5

这样才是