wxxx 发表于 2012-11-9 23:34:55

//Table 44.1  6 Indicator With 5 Non-Either-Or Qualifier—Version 1
Variable:e(0),aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),aaa(0),bbb(0),ccc(0),ddd(0),eee(0);
if C>O then e=1; else e:=0;
if C<O then e:=-1;
if C<C and C>C and C>C and C>C and C>C then aaa=1; else aaa:=0;
if C>C and C<C and C<C and C<C and C<C then aaa:=-1;
if C<C and C>C and C>C and C>C and C>C and C>C then bbb=1; else bbb:=0;
if C>C and C<C and C<C and C<C and C<C and C<C then bbb:=-1;
if L>L and L<LLV(L,3) and C>C  and C<Cthen ccc=1; else ccc:=0;
if H<H and H>HHV(H,3) and C<C and C>Cthen ccc:=-1;
if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then ddd=1; else ddd:=0;
if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then ddd:=-1;
if C<O and C<O then eee=1; else eee:=0;
if C>O and C>O then eee:=-1;
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 or ((high-low)>MA((high-low),10)) and C<C then dd:=1;
if ((high-low)<MA((high-low),10)) and C<C or ((high-low)>MA((high-low),10)) and C>C 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 MA(e,3)<0 then ff:=1;
if MA(e,3)>0 then ff:=-1;
if  aa+bb+cc+dd+ee+ff>0 and aaa+bbb+ccc+ddd+eee>=0 then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if  aa+bb+cc+dd+ee+ff<0 and aaa+bbb+ccc+ddd+eee<=0 then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
SetExitOnClose;

wxxx 发表于 2012-11-9 23:35:17

//Table 44.2  Filtered 6 Indicator With 66 Percent Stop
Variable:e(0),aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),aaa(0),bbb(0),ccc(0),ddd(0),eee(0);
if C>O then e=1; else e:=0;
if C<O then e:=-1;
if C<C and C>C and C>C and C>C and C>C then aaa=1; else aaa:=0;
if C>C and C<C and C<C and C<C and C<C then aaa:=-1;
if C<C and C>C and C>C and C>C and C>C and C>C then bbb=1; else bbb:=0;
if C>C and C<C and C<C and C<C and C<C and C<C then bbb:=-1;
if L>L and L<LLV(L,3) and C>C  and C<Cthen ccc=1; else ccc:=0;
if H<H and H>HHV(H,3) and C<C and C>Cthen ccc:=-1;
if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then ddd=1; else ddd:=0;
if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then ddd:=-1;
if C<O and C<O then eee=1; else eee:=0;
if C>O and C>O then eee:=-1;
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 or ((high-low)>MA((high-low),10)) and C<C then dd:=1;
if ((high-low)<MA((high-low),10)) and C<C or ((high-low)>MA((high-low),10)) and C>C 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 MA(e,3)<0 then ff:=1;
if MA(e,3)>0 then ff:=-1;
if  aa+bb+cc+dd+ee+ff>0 and aaa+bbb+ccc+ddd+eee>=0 then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
Sell('', DEFAULT, O[-1] -0.66*MA((high-low),3), -1, OT_Stop, OB_NextBar, '');
if  aa+bb+cc+dd+ee+ff<0 and aaa+bbb+ccc+ddd+eee<=0 then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
BuyToCover('', DEFAULT, O[-1] +0.66*MA((high-low),3), -1, OT_Stop, OB_NextBar, '');
SetExitOnClose;

wxxx 发表于 2012-11-9 23:35:41

//Table 44.3  Filter Indicator—66 Percent Stop—Version 2
Variable:e(0),aa(0),bb(0),cc(0),dd(0),ee(0),ff(0),aaa(0),bbb(0),ccc(0),ddd(0),eee(0);
if C>O then e=1; else e:=0;
if C<O then e:=-1;
if C<C and C>C and C>C and C>C and C>C then aaa=1; else aaa:=0;
if C>C and C<C and C<C and C<C and C<C then aaa:=-1;
if C<C and C>C and C>C and C>C and C>C and C>C then bbb=1 ;else bbb:=0;
if C>C and C<C and C<C and C<C and C<C and C<C then bbb:=-1;
if L>L and L<LLV(L,3) and C>C  and C<Cthen ccc=1 ;else ccc:=0;
if H<H and H>HHV(H,3) and C<C and C>Cthen ccc:=-1;
if HHV(L,3)-LLV(L,3)<=0.2*(HHV(H,3)-LLV(L,3)) then ddd=1; else ddd:=0;
if HHV(H,3)-LLV(H,3)<=0.2* (HHV(H,3)-LLV(L,3))then ddd:=-1;
if C<O and C<O then eee=1; else eee:=0;
if C>O and C>O then eee:=-1;
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 or ((high-low)>MA((high-low),10)) and C<C then dd:=1;
if ((high-low)<MA((high-low),10)) and C<C or ((high-low)>MA((high-low),10)) and C>C 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 MA(e,3)<0 then ff:=1;
if MA(e,3)>0 then ff:=-1;
if  (aa+bb+cc+dd+ee+ff>0 and aaa+bbb+ccc+ddd+eee>=0) or (aa+bb+cc+dd+ee+ff=0 and aaa+bbb+ccc+ddd+eee>0) then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
Sell('', DEFAULT, O[-1] -0.66*MA((high-low),3), -1, OT_Stop, OB_NextBar, '');
if  (aa+bb+cc+dd+ee+ff<0 and aaa+bbb+ccc+ddd+eee<=0) or  (aa+bb+cc+dd+ee+ff=0 and aaa+bbb+ccc+ddd+eee<0) then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
BuyToCover('', DEFAULT, O[-1] +0.66*MA((high-low),3), -1, OT_Stop, OB_NextBar, '');
SetExitOnClose;

wxxx 发表于 2012-11-9 23:38:56

wxxx 发表于 2012-10-14 22:26 static/image/common/back.gif
大家可以思考下下面2句的 O[-1] -0.66*MA((high-low),3)    O[-1] +0.66*MA((high-low),3)
Sell('', DEFAUL ...

在23楼里提到“由于金魔方nthhighest类似的函数暂时没有实现,我们后面直接跳到24章。”
mc的nthhighest,金魔方有了相同效果的nthhigher,下帖补上遗漏的。

wxxx 发表于 2012-11-13 21:11:54

//Table 21.1  第2最高最低点出场策略.
Variable: hh(0),ll(0),q(0),u(0),x(0),y(0),z(0);
if MarketPosition=1 and BarsSinceEntry=0 then hh:=H;
if MarketPosition=-1 and BarsSinceEntry=0 then ll:=L;
if C>MA(C,40) then q:=1;
if C<MA(C,40) then q:=-1;
IF MA(C,2)<MA(C,5)then u:=1;
if MA(C,2)>MA(C,5)then u:=-1;
if HHVBars(C,50)>LLVBars(C,50) then x:=1;
if HHVBars(C,50)<LLVBars(C,50) then x:=-1;
if (KRange<MA(KRange,10) and C>C)or (KRange>MA(KRange,10) and C<C) then y:=1;
if (KRange<MA(KRange,10) and C<C) or (KRange>MA(KRange,10) and C>C)then y:=-1;
if C>(MA(H,15)+MA(L,15))/2 then z:=1;
if C<(MA(H,15)+MA(L,15))/2 then z:=-1;
if q+u+x+y+z>0 and C>MA(C,20) then Buy('', DEFAULT, O[-1] -.33*MA(KRange,3), 0, OT_Limit, OB_NextBar,  'b');
if BarsSinceEntry=2 and MarketPosition=1 and HHV(H,2)>hh and nthhigher(H,2,2)>hh then Sell('', DEFAULT, HHV(H,2), 0, OT_Limit, OB_NextBar, 's2');
if BarsSinceEntry=3 and MarketPosition=1 and HHV(H,3)>hh and nthhigher(H,3,2)>hh then Sell('', DEFAULT, HHV(H,3), 0, OT_Limit, OB_NextBar, 's3');
if BarsSinceEntry=4 and MarketPosition=1 and HHV(H,4)>hh and nthhigher(H,4,2)>hh then Sell('', DEFAULT, HHV(H,4), 0, OT_Limit, OB_NextBar, 's4');
if BarsSinceEntry=5 and MarketPosition=1 and HHV(H,5)>hh and nthhigher(H,5,2)>hh then Sell('', DEFAULT, HHV(H,5), 0, OT_Limit, OB_NextBar, 's5');
if BarsSinceEntry=6 and MarketPosition=1 and HHV(H,6)>hh and nthhigher(H,6,2)>hh then Sell('', DEFAULT, HHV(H,6), 0, OT_Limit, OB_NextBar, 's6');
if BarsSinceEntry=7 and MarketPosition=1 and HHV(H,7)>hh and nthhigher(H,7,2)>hh then Sell('', DEFAULT, HHV(H,7), 0, OT_Limit, OB_NextBar, 's7');
if BarsSinceEntry=8 and MarketPosition=1 and HHV(H,8)>hh and nthhigher(H,8,2)>hh then Sell('', DEFAULT, HHV(H,8), 0, OT_Limit, OB_NextBar, 's8');
if BarsSinceEntry=9 and MarketPosition=1 and HHV(H,9)>hh and nthhigher(H,9,2)>hh then Sell('', DEFAULT, HHV(H,9), 0, OT_Limit, OB_NextBar, 's9');
if BarsSinceEntry=10 and MarketPosition=1 and HHV(H,10)>hh and nthhigher(H,10,2)>hh then Sell('', DEFAULT, HHV(H,10), 0, OT_Limit, OB_NextBar, 's10');
if BarsSinceEntry=11 and MarketPosition=1 and HHV(H,11)>hh and nthhigher(H,11,2)>hh then Sell('', DEFAULT, HHV(H,11), 0, OT_Limit, OB_NextBar, 's11');
if BarsSinceEntry=12 and MarketPosition=1 and HHV(H,12)>hh and nthhigher(H,12,2)>hh then Sell('', DEFAULT, HHV(H,12), 0, OT_Limit, OB_NextBar, 's12');
if BarsSinceEntry=13 and MarketPosition=1 and HHV(H,13)>hh and nthhigher(H,13,2)>hh then Sell('', DEFAULT, HHV(H,13), 0, OT_Limit, OB_NextBar, 's13');
if BarsSinceEntry=14 and MarketPosition=1 and HHV(H,14)>hh and nthhigher(H,14,2)>hh then Sell('', DEFAULT, HHV(H,14), 0, OT_Limit, OB_NextBar, 's14');
if C<MA(C,20) then Sell('', DEFAULT, 0, 0, OT_Market, OB_NextBar, 's');
if q+u+x+y+z<0 and C<MA(C,20)then SellShort('', DEFAULT, O[-1] +.33*MA(KRange,3), 0, OT_Limit, OB_NextBar,  'ss');
if BarsSinceEntry=2 and MarketPosition=-1 and LLV(L,2)<ll and nthlower(L,2,2)<ll then BuyToCover('', DEFAULT, LLV(L,2), 0, OT_Limit, OB_NextBar, 'bc2');
if BarsSinceEntry=3 and MarketPosition=-1 and LLV(L,3)<ll and nthlower(L,3,2)<ll then BuyToCover('', DEFAULT, LLV(L,3), 0, OT_Limit, OB_NextBar, 'bc3');
if BarsSinceEntry=4 and MarketPosition=-1 and LLV(L,4)<ll and nthlower(L,4,2)<ll  then BuyToCover('', DEFAULT, LLV(L,4), 0, OT_Limit, OB_NextBar, 'bc4');
if BarsSinceEntry=5 and MarketPosition=-1 and LLV(L,5)<ll and nthlower(L,5,2)<ll  then BuyToCover('', DEFAULT, LLV(L,5), 0, OT_Limit, OB_NextBar, 'bc5');
if BarsSinceEntry=6 and MarketPosition=-1 and LLV(L,6)<ll and nthlower(L,6,2)<ll then BuyToCover('', DEFAULT, LLV(L,6), 0, OT_Limit, OB_NextBar, 'bc6');
if BarsSinceEntry=7 and MarketPosition=-1 and LLV(L,7)<ll and nthlower(L,7,2)<ll  then BuyToCover('', DEFAULT, LLV(L,7), 0, OT_Limit, OB_NextBar, 'bc7');
if BarsSinceEntry=8 and MarketPosition=-1 and LLV(L,8)<ll and nthlower(L,8,2)<ll  then BuyToCover('', DEFAULT, LLV(L,8), 0, OT_Limit, OB_NextBar, 'bc8');
if BarsSinceEntry=9 and MarketPosition=-1 and LLV(L,9)<ll and nthlower(L,9,2)<ll then BuyToCover('', DEFAULT, LLV(L,9), 0, OT_Limit, OB_NextBar, 'bc9');
if BarsSinceEntry=10 and MarketPosition=-1 and LLV(L,10)<ll and nthlower(L,10,2)<ll  then BuyToCover('', DEFAULT, LLV(L,10), 0, OT_Limit, OB_NextBar, 'bc10');
if BarsSinceEntry=11 and MarketPosition=-1 and LLV(L,11)<ll and nthlower(L,11,2)<ll then BuyToCover('', DEFAULT, LLV(L,11), 0, OT_Limit, OB_NextBar, 'bc11');
if BarsSinceEntry=12 and MarketPosition=-1 and LLV(L,12)<ll and nthlower(L,12,2)<ll  then BuyToCover('', DEFAULT, LLV(L,12), 0, OT_Limit, OB_NextBar, 'bc12');
if BarsSinceEntry=13 and MarketPosition=-1 and LLV(L,13)<ll and nthlower(L,13,2)<ll  then BuyToCover('', DEFAULT, LLV(L,13), 0, OT_Limit, OB_NextBar, 'bc13');
if BarsSinceEntry=14 and MarketPosition=-1 and LLV(L,14)<ll and nthlower(L,14,2)<ll  then BuyToCover('', DEFAULT, LLV(L,14), 0, OT_Limit, OB_NextBar, 'bc14');
if C>MA(C,20) then BuyToCover('', DEFAULT, 0, 0, OT_Market, OB_NextBar, 'bc');
{
做多条件:
1,收盘价大于40天均值的收盘价
2,2天均值的收盘价小于5天均值的收盘价
3,50天内的最高价出现在50天内的最低价之前
4,振幅小于10天平均振幅,收盘价比较高;或振幅
大于10天平均振幅,收盘价比较低(小的振幅意味着跟随,大
的振幅意味的反着做)
5,收盘价大于15天的中点均值(15天最高平均价加最低平均价,再
除以2)

另外加一个限制条件:收盘价大于20天均值
}

wangyuanh 发表于 2012-11-19 07:19:55

想下载书籍下载不下来呀

客服_wenwen 发表于 2012-11-19 10:36:43

wangyuanh 发表于 2012-11-19 07:19 static/image/common/back.gif
想下载书籍下载不下来呀

刚测试过,首页的书籍可以下载的,直接点击就可以了。

wangyuanh 发表于 2012-11-20 05:04:22

我下载后怎么只有10K,解压说是文件被损坏。

ktdev 发表于 2012-11-30 21:35:11

333333 发表于 2012-9-26 15:44 static/image/common/back.gif
其实在国内,程序化交易的胜算远高于国外,就是因为太多没有独立思维能力、习惯线性思考的对手盘.
大家早点 ...

{
//Table 5.2  收盘价 vs 均价
//Table 7.1  2天 vs 5天
//Table 8.2 最高收盘价,最低收盘价
}

//Table 9.1  3个指标综合策略
Variable: x(0),y(0),z(0);
if C>MA(C,40) then x:=1;
if C<MA(C,40) then x:=-1;
IF MA(C,2)<MA(C,5)then y:=1;
if MA(C,2)>MA(C,5)then y:=-1;
if HHVBars(C,50)>LLVBars(C,50) then z:=1;
if HHVBars(C,50)<LLVBars(C,50) then z:=-1;
if x+y+z>0 then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if x+y+z<0 then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
SetExitOnClose;
{
x+y+z>0,只有在3个单独的策略都发出买入信号才成立
同理,x+y+z<0,都发出卖空信号
}

股神心法 发表于 2013-1-15 17:31:21

非常好,谢谢,:handshake
页: 1 2 3 4 5 6 7 8 [9] 10 11 12 13
查看完整版本: 战胜金融期货市场(把小的市场优势整合成为强大的赚钱策略)