以文本方式查看主题

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

--  作者:qwe8899
--  发布时间:2014/10/30 10:51:22
--  如下模型请转为股票交易模型
老师好如下模型请转为股票交易模型.要求开多不开空!

VARIABLE:a=0,b=0,s1=2,s2=2;
m:=26;
k:=2;
MID:  MA(CLOSE,M);//布林中轨
UPPER: MID + K*STD(CLOSE,M);//布林上轨
LOWER: MID - K*STD(CLOSE,M);//布林下轨

kk:cross(h,upper);
kd:cross(l,lower);
tt:=upper-lower>=30;
if kd and tt and holding=0 then begin 
buy(1,1,market);
a:=0;
s1:=2;
end
if enterprice-l=10 and holding>0 and a<6 then begin
buy(1,s1,market);
a:=a+1;
s1:=2*s1;
end
if h-enterprice>=16 then sell(holding>0,holding,market);//多头止盈
if enterprice-l>=30 then sell(holding>0,holding,market);//多头止损
if kk and tt and holding=0 then begin
 buyshort(1,1,market);
 b:=0;
 s2:=2;
 end
if enterprice-l=10 and holding<0 and b<6 then begin
buyshort(1,s2,market);
b:=b+1;
s2:=2*s2;
end
if enterprice-l>=16 then sellshort(holding<0,holding,market);//空头止盈
if h-ENTERPRICE>=30 then sellshort(holding<0,holding,market);//空头止损

--  作者:jinzhe
--  发布时间:2014/10/30 11:08:09
--  
你把开空的拿一些删了不就行了?
--  作者:qwe8899
--  发布时间:2014/10/30 11:24:32
--  
不行呢.放到股票试无信号出呢
--  作者:jinzhe
--  发布时间:2014/10/30 11:30:02
--  
那么原封不动的,有有信号没?
--  作者:qwe8899
--  发布时间:2014/10/30 11:37:17
--  
期货有股票无
--  作者:jinzhe
--  发布时间:2014/10/30 13:15:48
--  
此策略不适用于股票
--  作者:qwe8899
--  发布时间:2014/11/25 9:44:05
--  
老师好如下模型请改为每次反方向加仓.并且平掉上次仓位.谢谢!

VARIABLE:a=0,b=0,s1=2,s2=2;
m:=26;
k:=2;
MID:  MA(CLOSE,M);//布林中轨
UPPER: MID + K*STD(CLOSE,M);//布林上轨
LOWER: MID - K*STD(CLOSE,M);//布林下轨

kk:cross(h,upper);
kd:cross(l,lower);
tt:=upper-lower>=30;
if kd and tt and holding=0 then begin 
buy(1,1,market);
a:=0;
s1:=2;
end
if enterprice-l=10 and holding>0 and a<6 then begin
buy(1,s1,market);
a:=a+1;
s1:=2*s1;
end
if h-enterprice>=16 then sell(holding>0,holding,market);//多头止盈
if enterprice-l>=30 then sell(holding>0,holding,market);//多头止损
if kk and tt and holding=0 then begin
 buyshort(1,1,market);
 b:=0;
 s2:=2;
 end
if enterprice-l=10 and holding<0 and b<6 then begin
buyshort(1,s2,market);
b:=b+1;
s2:=2*s2;
end
if enterprice-l>=16 then sellshort(holding<0,holding,market);//空头止盈
if h-ENTERPRICE>=30 then sellshort(holding<0,holding,market);//空头止损


--  作者:jinzhe
--  发布时间:2014/11/25 9:50:37
--  
那么你平仓反向开仓条件是什么?