wxxx 发表于 2012-10-27 00:05:57

//Table 33.1  区间突破加“2个方向一致”过滤器
Input:u(0.6),n(20);
Variable: x(0);
if (C>C and C>C)or (C<C and C<C)then x=1; else x:=0;
if MA(x,n)>u then Buy('', DEFAULT, O[-1] +(.5*MA(KRange,3)), -1, OT_Stop, OB_NextBar,  '');
Sell('', DEFAULT, O[-1] -(.5*MA(KRange,3)), -1, OT_Stop, OB_NextBar, '');
if MA(x,n)<u then SellShort('', DEFAULT, O[-1] -(.5*MA(KRange,3)), -1, OT_Stop, OB_NextBar,  '');
BuyToCover('', DEFAULT, O[-1] +(0.5*MA(KRange,3)), -1, OT_Stop, OB_NextBar, '');
{
把开盘价加上前3天平均振幅的50%作为买入价;
把开盘价减去前3天平均振幅的50%作为做空价。

如果最近20天内x的平均值大于或大于0.6,我们就在第二天下单;
市场逆向走动到0.5就止损出场。

}

麒智 发表于 2012-10-29 16:40:34

一点点的学习,
谢楼主的辛苦劳动.

wxxx 发表于 2012-10-30 09:41:34

//table 34   13:30入场系统
{
1,日内系统
2,周期:1分钟周期
3,与原书里的时间做了调整,适应股指期货
}
Input: x(15.05);
Variable:hh(0),ll(0),hhh(0),lll(0);
if Time>=93000 and Time<93100 then hh:=H;
if Time>=93000 and Time<93100 then ll:=L;
if Time>=112900  and Time<113000 then hhh:=H;
if Time>=112900  and Time<113000 then lll:=L;
if Time>=133000  and Time<133100 and OpenD(0)-LowD(0)<=.25*(HighD(0)-LowD(0))and HighD(0)>hhh and hhh>hh then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if Time>=(x*10000) and Time<(x+0.01)*10000 then Sell('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');
if Time>=133000 and Time<133100 and HighD(0)-OpenD(0)<=.25*(HighD(0)-LowD(0))and LowD(0)<lll and lll<ll then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if Time>=(x*10000) and Time<(x+0.01)*10000 then BuyToCover('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');
{
买入条件:
1,OpenD(0)-LowD(0)<=.25*(HighD(0)-LowD(0))
2,最高价必须必11:29分的价格高=====HighD(0)>hhh
3,11:29的高价必须必9:30分的高=====hhh>hh

反之则卖出。
}

wxxx 发表于 2012-10-30 20:25:42

//table 35.1  9个开盘价到收盘价多数一致(5分钟)
Variable:e(0);
if C>O then e=1 ;else e:=0;
if C<O then e:=-1;
if Time>=100000 and Time<=144500 and MA(e,9)>0 then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if Time=150000 and Time<150100 then Sell('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');
if Time>=100000 and Time<=144500 and MA(e,9)<0 then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if Time>=150000 and Time<150100 then BuyToCover('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');
{
如果市场环境适合做日内交易的多头,你可能就会看到大部分K线的收盘价比开盘价高,
反之则适合做空。
从10点到14:45,根据9条K线的具体数值,决定做空做多,下午3点出场。
}

wxxx 发表于 2012-10-31 20:31:39

//table 35.2  
if Time>=91500 and Time<=144500 and C>(HighD(0)+LowD(0))/2 then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if Time>=150000 and Time<150100 then Sell('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');
if Time>=91500 and Time<=144500 and C<(HighD(0)+LowD(0))/2 then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if Time>=150000 and Time<150100 then BuyToCover('', DEFAULT, 0, 0, OT_Market, OB_NextBar, '');

wxxx 发表于 2012-10-31 20:44:02

//Table 36.1  
if C>C and C<C and C<C and C<C and C<C and C<C then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if C<C and C>C and C>C and C>C and C>C and C>C then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
SetExitOnClose;
{
如果市场的收盘价连续5天下跌,且在第六天上涨,那么随后一天做多;
反之亦然
}

wxxx 发表于 2012-10-31 21:10:41

//Table 36.2  
if C<C and C>C and C>C and C>C and C>C and C>C  then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if C>C and C<Cand C<C and C<C and C<C and C<C  then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
{
与36.1的开仓逻辑相反
如果市场的收盘价连续5天下跌,且在第六天上涨,那么随后一天做空;
反之亦然
另外,此策略是直到出现反转信号,才平仓开新仓
}

wxxx 发表于 2012-10-31 21:15:19

if C<C and C>C and C>C and C>C and C>C and C>C then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if C>C and C<C and C<C and C<C and C<C and C<C then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
{
对比36.2,可以发现,此策略是 市场的收盘价连续5天下跌,且在第六天上涨,
第7天不管(因为没有比较c与c的大小关系),第八天做空;
反之亦然。
直到出现反转信号,才平仓开新仓。
}

wxxx 发表于 2012-10-31 21:20:46

//table 36.4
if C<C and C>C and C>C and C>C and C>C and C>C then Buy('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');
if C>C and C<C and C<C and C<C and C<C and C<C then SellShort('', DEFAULT, 0, 0, OT_Market, OB_NextBar,  '');

SetExitOnClose;
{
与上面的36.3相比,不同是36.3是永久在市场,本策略是日内平仓
}

wxxx 发表于 2012-10-31 21:24:01

后面我们说其他  反着做的思路。
页: 1 2 3 4 5 [6] 7 8 9 10 11 12 13
查看完整版本: 战胜金融期货市场(把小的市场优势整合成为强大的赚钱策略)