以文本方式查看主题
- 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp)
-- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4)
---- [推荐]请版主把它改为金字塔模式 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=29926)
|
-- 作者:系统使用者
-- 发布时间:2012/10/18 13:31:09
-- [推荐]请版主把它改为金字塔模式
指标组合策略: Variable: aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),gg(0),hh(0); IF MA(C,2)<MA(C,5)then aa:=1; if MA(C,2)>MA(C,5)then aa:=-1; if C>MA(C,40) then bb:=1; if C<MA(C,40) then bb:=-1; if HHVBars(C,50)>LLVBars(C,50) then cc:=1; if HHVBars(C,50)<LLVBars(C,50) then cc:=-1; if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1; if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1; if C>(MA(H,15)+MA(L,15))/2 then ee:=1; if C<(MA(H,15)+MA(L,15))/2 then ee:=-1; if C<O and C[1]<O[1] then ff=1; else ff:=0; if C>O and C[1]>O[1] then ff:=-1; if L>L[1] and L[1]<LLV(L,3)[2] and C>C[1] and C[1]<C[2]then gg=1; else gg:=0; if H<H[1] and H[1]>HHV(H,3)[2] and C<C[1] and C[1]>C[2]then gg:=-1; if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0; if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1; if aa+bb+cc+dd+ee+ff+gg+hh>0 then Buy(\'\', DEFAULT, 0, 0, OT_Market, OB_NextBar, \'\'); if aa+bb+cc+dd+ee+ff+gg+hh<0 then SellShort(\'\', DEFAULT, 0, 0, OT_Market, OB_NextBar, \'\'); SetExitOnClose;
|
-- 作者:sunjunwin
-- 发布时间:2012/10/18 14:20:15
--
大体都能用吧 估计只有几个变量和数组没定义 定义一下不就成了
|
-- 作者:jinzhe
-- 发布时间:2012/10/18 14:25:51
--
Variable: aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),gg(0),hh(0); IF MA(C,2)<MA(C,5)then aa:=1; if MA(C,2)>MA(C,5)then aa:=-1; if C>MA(C,40) then bb:=1; if C<MA(C,40) then bb:=-1; if HHVBars(C,50)>LLVBars(C,50) then cc:=1; if HHVBars(C,50)<LLVBars(C,50) then cc:=-1; if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1; if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1; if C>(MA(H,15)+MA(L,15))/2 then ee:=1; if C<(MA(H,15)+MA(L,15))/2 then ee:=-1; if C<O and C[1]<O[1] then ff=1; else ff:=0; if C>O and C[1]>O[1] then ff:=-1; if L>L[1] and L[1]<LLV(L,3)[2] and C>C[1] and C[1]<C[2]then gg=1; else gg:=0; if H<H[1] and H[1]>HHV(H,3)[2] and C<C[1] and C[1]>C[2]then gg:=-1; if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0; if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1; 前面可以如此修改
最后3句:
if aa+bb+cc+dd+ee+ff+gg+hh>0 then Buy(\'\', DEFAULT, 0, 0, OT_Market, OB_NextBar, \'\');请解释BUY里面各个参数的含义
if aa+bb+cc+dd+ee+ff+gg+hh<0 then SellShort(\'\', DEFAULT, 0, 0, OT_Market, OB_NextBar, \'\');请解释SELLSRHOT里面各个参数的含义
SetExitOnClose;请解释该函数的含义
|
-- 作者:系统使用者
-- 发布时间:2012/10/18 15:16:38
--
SetExitOnClose;请解释该函数的含义
收盘平仓
|
-- 作者:系统使用者
-- 发布时间:2012/10/18 15:20:07
--
Variable: aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),gg(0),hh(0); IF MA(C,2)<MA(C,5)then aa:=1; if MA(C,2)>MA(C,5)then aa:=-1; if C>MA(C,40) then bb:=1; if C<MA(C,40) then bb:=-1; if HHVBars(C,50)>LLVBars(C,50) then cc:=1; if HHVBars(C,50)<LLVBars(C,50) then cc:=-1; if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1; if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1; if C>(MA(H,15)+MA(L,15))/2 then ee:=1; if C<(MA(H,15)+MA(L,15))/2 then ee:=-1; if C<O and C[1]<O[1] then ff=1; else ff:=0; if C>O and C[1]>O[1] then ff:=-1; if L>L[1] and L[1]<LLV(L,3)[2] and C>C[1] and C[1]<C[2]then gg=1; else gg:=0; if H<H[1] and H[1]>HHV(H,3)[2] and C<C[1] and C[1]>C[2]then gg:=-1; if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0; if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1;
if aa+bb+cc+dd+ee+ff+gg+hh>0 then buy(1,25%,limitr,close); if aa+bb+cc+dd+ee+ff+gg+hh<0 then buyshort(1,25%,limitr,close);
通不过
|
-- 作者:系统使用者
-- 发布时间:2012/10/18 15:21:54
--
if L>L[1] and L[1]<LLV(L,3)[2] and C>C[1] and C[1]<C[2]then gg=1; else gg:=0;
也通不过
|
-- 作者:jinzhe
-- 发布时间:2012/10/18 15:22:32
--
我晕,怎么复制的是原来没修改过的代码
这个是修改过的
Variable: aa=0,bb=0,cc=0,dd=0,ee=0,ff=0,gg=0,hh=0; IF MA(C,2)<MA(C,5)then aa:=1; if MA(C,2)>MA(C,5)then aa:=-1; if C>MA(C,40) then bb:=1; if C<MA(C,40) then bb:=-1; if HHVBars(C,50)>LLVBars(C,50) then cc:=1; if HHVBars(C,50)<LLVBars(C,50) then cc:=-1; if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1; if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1; if C>(MA(H,15)+MA(L,15))/2 then ee:=1; if C<(MA(H,15)+MA(L,15))/2 then ee:=-1; if C<O and C[1]<O[1] then ff=1; else ff:=0; if C>O and C[1]>O[1] then ff:=-1; if L>L[1] and L[1]<ref(LLV(L,3),2) and C>C[1] and C[1]<C[2]then gg:=1; else gg:=0; if H<H[1] and H[1]>ref(HHV(H,3),2) and C<C[1] and C[1]>C[2]then gg:=-1; if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0; if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1;
|
-- 作者:系统使用者
-- 发布时间:2012/10/18 15:23:55
--
而且结果也不对
|
-- 作者:系统使用者
-- 发布时间:2012/10/18 15:24:06
--
Variable: aa:=0,bb:=0,cc:=0,dd:=0,ee:=0,ff:=0,gg:=0,hh:=0; IF MA(C,2)<MA(C,5)then aa:=1; if MA(C,2)>MA(C,5)then aa:=-1; if C>MA(C,40) then bb:=1; if C<MA(C,40) then bb:=-1; if HHVBars(C,50)>LLVBars(C,50) then cc:=1; if HHVBars(C,50)<LLVBars(C,50) then cc:=-1; if ((high-low)<MA((high-low),10)) and C>C[1] or ((high-low)>MA((high-low),10)) and C<C[1] then dd:=1; if ((high-low)<MA((high-low),10)) and C<C[1] or ((high-low)>MA((high-low),10)) and C>C[1] then dd:=-1; if C>(MA(H,15)+MA(L,15))/2 then ee:=1; if C<(MA(H,15)+MA(L,15))/2 then ee:=-1; if C<O and C[1]<O[1] then ff=1; else ff:=0; if C>O and C[1]>O[1] then ff:=-1; if L>L[1] and L[1]<LLV(L,3) and C>C[1] and C[1]<C[2]then gg=1; else gg:=0; if H<H[1] and H[1]>HHV(H,3) and C<C[1] and C[1]>C[2]then gg:=-1; if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then hh=1; else hh:=0; if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then hh:=-1;
if aa+bb+cc+dd+ee+ff+gg+hh>0 then buy(1,25%,limitr,close); if aa+bb+cc+dd+ee+ff+gg+hh<0 then buyshort(1,25%,limitr,close);
|
-- 作者:jinzhe
-- 发布时间:2012/10/18 15:24:20
--
收盘前平仓,以股指1分钟周期为例:
if time>151300 and time<=151500 then begin
sell(1,0,market);
sellshort(1,0,market);
end
|