1.?满仓满仓???Դ??
2.不知道哪位大大可以解释下网格交易法?
3.通达信捕捉牛股利器 条件选股公式
4.量化交易 | 网格交易大法
????Դ??
{ 波段线}
VAR2:=(HIGH+LOW+CLOSE*2)/4;
VAR3:=EMA(VAR2,);
VAR4:=STD(VAR2,);
VAR5:=((VAR2-VAR3)/VAR4*+)/4;
VAR6:=(EMA(VAR5,5)-)*1.;
{ AK: EMA(VAR6,2)*1.;
AD1: EMA(AK,2);
AJ: 3*AK-2*AD1;
DRAWTEXT(CROSS(AK,AD1),AK,'*'),COLORRED;
DRAWTEXT(CROSS(AD1,AK),AK,'*'),COLORWHITE;}
{ 金手指}
RA:=LLV(LOW,);
RB:=HHV(HIGH,);
RC:=EMA((CLOSE-RA)/(RB-RA)*4,4)*;
近日均价:=MA(CLOSE,5),COLORYELLOW,LINETHICK2;
DRAWICON(RC<6 AND *(HHV(HIGH,)-CLOSE)/(HHV(HIGH,)-LLV(LOW,))>,,);
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*;
ZL:=EMA( (CLOSE-MA(CLOSE,7))/MA(CLOSE,7)*,2)*5;
SH:=EMA( (CLOSE-MA(CLOSE,))/MA(CLOSE,)*,7)*5;
BT1:=CROSS(RSI1,);
BT2:=CROSS(ZL,SH) AND ZL<-;
BT:=FILTER(COUNT(BT1 OR BT2,3)>=2,3);
BIAS:=(CLOSE-MA(CLOSE,))/MA(CLOSE,)*;
VARC:=LOW;
VARD:=REF(LOW,1);
VARE:=SMA(ABS(VARC-VARD),3,1)/SMA(MAX(VARC-VARD,0),3,1)*;
VARF:=MA(VARE/,3);
VAR:=LLV(LOW,);
VAR:=HHV(VARF,);
MA(IF(LOW<=VAR,(VARF+VAR*2)/5,0),3);
VAR1B:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
VAR2B:=SMA(ABS(LOW-VAR1B),,1)/SMA(MAX(LOW-VAR1B,0),,1);
VAR3B:=EMA(VAR2B,);
VAR4B:=LLV(LOW,);
VAR5B:=EMA(IF(LOW<=VAR4B,VAR3B,0),3);
{ 主力进场:IF(VAR5B>REF(VAR5B,1),VAR5B,0),COLORRED;}
STICKLINE(VAR5B>REF(VAR5B,1),0,VAR5B*2,2,0 ),COLORYELLOW;
洗盘:IF(VAR5B<REF(VAR5B,1),VAR5B,0),COLORLIGREEN;
VARR1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
VARR2:=SMA(ABS(LOW-VARR1),,1)/SMA(MAX(LOW-VARR1,0),,1);
VARR3:=EMA(VARR2,);
VARR4:=LLV(LOW,);
VARR5:=EMA(IF(LOW<=VARR4,VARR3,0),3);
STICKLINE(VARR5>REF(VARR5,1),0,VARR5,2,0 ),COLORGREEN;
STICKLINE(VARR5<REF(VARR5,1),0,VARR5*2,2,0),COLORRED;
找主力吸筹提款:VARR5>REF(VARR5,4) { AND C>REF(C,1)},COLORMAGENTA;
VAR2C:=(HIGH+LOW+CLOSE*2)/4;
VAR3C:=EMA(VAR2C,7);
VAR4C:=STD(VAR2C,7);
VAR5C:=(VAR2C-VAR3C)*/VAR4;
VAR6C:=EMA(VAR5C,3);
{ WW:(EMA(VAR6C,5)+)/2-3,COLORFFFF;
MM:HHV(WW,3),COLORFF;}
AAA:=AMOUNT/VOL/;
主力进场:IF(VAR5B>REF(VAR5B,1),VAR5B*1.5,0),COLORRED,LINETHICK2;
{ 吸筹}
VAR2Q:=REF(LOW,1);
VAR3Q:=SMA(ABS(LOW-VAR2Q),3,1)/SMA(MAX(LOW-VAR2Q,0),3,1)*;
VAR4Q:=EMA(IF(CLOSE*1.3,VAR3Q*,VAR3Q/),3);
VAR5Q:=LLV(LOW,);
VAR6Q:=HHV(VAR4Q,);
VAR7Q:=IF(MA(CLOSE,),1,0);
VAR8Q:=EMA(IF(LOW<=VAR5Q,(VAR4Q+VAR6Q*2)/2,0),3)/*VAR7Q;
VAR9Q:=IF(VAR8Q>,,VAR8Q);
吸筹:STICKLINE(VAR9Q>-,0,VAR9Q,6,1),COLORRED;
VARY2:=REF(LOW,1);
VARY3:=SMA(ABS(LOW-VARY2),3,1)/SMA(MAX(LOW-VARY2,0),3,1)*;
VARY4:=EMA(IF(CLOSE*1.3,VARY3*,VARY3/),3);
VARY5:=LLV(LOW,);
VARY6:=HHV(VARY4,);
VARY7:=IF(MA(CLOSE,),1,0);
VARY8:=EMA(IF(LOW<=VARY5,(VARY4+VARY6*2)/2,0),3)/*VARY7;
VARY9:=IF(VARY8>,,VARY8);
吸筹2:STICKLINE(VARY9>-,0,VARY9/3,2,1),COLORMAGENTA;
LCC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LCC,0),4.1,1)/SMA(ABS(CLOSE-LCC),4.1,1)*,COLORYELLOW,LINETHICK1;
黄买:FILTER((REF(CLOSE,2)<CLOSE AND RSI<),7),COLORYELLOW;
STICKLINE(黄买,0,-,,1),COLORYELLOW;
黄卖:=FILTER((REF(CLOSE,2)>CLOSE AND RSI>),7);
STICKLINE(黄卖,,,,0),COLORBLUE;
红买:FILTER(CROSS(RSI,),7),COLORRED;
STICKLINE(红买,0,-,6,0),COLORRED;
红卖:=FILTER(CROSS(,RSI),7);
STICKLINE(红卖,,,8,0),COLORCYAN;
绿买:FILTER(CROSS(RSI,),7),COLORFF;
STICKLINE(绿买,0,-,6,0),COLORMAGENTA;
绿卖:=FILTER(CROSS(,RSI),7);
STICKLINE(绿卖,,,6,0),COLORFF;
★遵守纪律★:,COLORRED;
★交易之魂★:,COLORRED;
ZLC:= EMA((WINNER(CLOSE) * ),3);
SHC:= EMA(((WINNER((CLOSE * 1.1)) - WINNER((CLOSE * 0.9))) * ),3);
主力控盘: ((ZLC / (ZLC+ SHC)) * ),COLORFFFF,LINETHICK2;
上限: HHV(主力控盘,),COLORGREEN,LINETHICK2;
下限: LLV(主力控盘,),COLORRED,LINETHICK2;
中线:(上限 + 下限)/2,COLORYELLOW,POINTDOT,LINETHICK2;
{ ,LINETHICK4,POINTDOT,COLORYELLOW;}
{ ,LINETHICK4,POINTDOT,COLORFFFF;}
VAR:=(CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*;
VAR:=SMA(SMA(VAR,3,1),3,1)/.;
VAR:=EMA(VAR,5);
操盘:=3*VAR-2*VAR;
A1:=CROSS(操盘,VAR) AND VAR<2.1 AND C>O;
STICKLINE(A1,,0,4,0),COLOR;
STICKLINE(A1,,0,3,0),COLOR;
STICKLINE(A1,,0,2,0),COLORBBBB;
STICKLINE(A1,,0,1,0),COLORWHITE;
STICKLINE(A1,,0,0.3,0),COLORFFFF;
DRAWTEXT(A1,,'满仓'),COLORRED;
DRAWTEXT(A1,,'满仓'),COLORRED;
AK: EMA(VAR6,2)*1.;
AD1: EMA(AK,2);
AJ: 3*AK-2*AD1;
DRAWTEXT(CROSS(AK,AD1),AK,'*'),COLORRED;
DRAWTEXT(CROSS(AD1,AK),AK,'*'),COLORWHITE;
WW:(EMA(VAR6C,5)+)/2-3,COLORFFFF;
MM:HHV(WW,3),COLORFF;
DRAWTEXT(BT1,0,'□'),COLORYELLOW;
DRAWTEXT(BT,0,'■'),COLORYELLOW;
DRAWICON(CROSS(,RSI1),,);{ 饭跑跑}
DRAWICON(CROSS(RSI1,),,);{ 金钻}
DRAWICON(CROSS(ZL,SH) AND ZL<-,,);{ 蓝钻}
DRAWICON(CROSS(BIAS,-),-,);{ BIAS买点};
不知道哪位大大可以解释下网格交易法?
网格交易是啥子这是一种仓位策略,用于动态调仓。源码该大法秉持的操作原则是"仓位策略比选股策略更重要"。当然,满仓满仓我们做策略的源码,选出好的操作赢家波谱公式源码股票池是我们孜孜不倦的追求~~
几个基本概念
1.底仓价:价格的标准线,建仓和调仓的满仓满仓重要依据。
2.低吸高抛:仓位控制贯彻低吸高抛,源码绝不追涨杀跌。操作根据网格设置买卖价位。满仓满仓下面举个例子
在底仓价的源码附近,我们根据网格的操作大小,比如每跌3%按仓位买入(第一档:买%,满仓满仓第二档:买%,源码瑞彩源码第三档:买%,操作第四档:买%)。要注意的是,这里买卖不是绝对的定量,而是调仓到对应仓位。如果第一次跌破3%,而后上涨到5%时,是不操作的,因为下跌时只建了%的仓,而上涨5%的仓位是%,不够抛出。
3.网格大小:上图给出了3种网格大小。特点是崇明网站源码买入网格小于卖出网格。这种不对称编织网格的道理在于网格的目的是网获利润,将利润建立在趋势的必然性中,而不仅仅是靠震荡的偶然性。
先讲特点和局限吧
首先,定理&公理:没有万能的策略。
1.趋势决定策略的成败。在长期的上涨趋势中策略才能获得满意回报。
2.选股集中在波动大、成长性好的中小市值股票。不断盘整的周期股、大盘股和业绩不佳的垃圾股踩中就麻烦了。
3.底仓价格设定在安全边际内。在估值顶部设立底仓价格风险极大,解忧婚礼源码会造成很大的损失。
4.牛市表现不佳。分散的仓位策略,没有依据价格形态来修改网格,都可能在牛市中跑输大盘。降低贝塔的代价就是阿尔法也较低。
5.买卖规则不灵活,可能使一些重要的突破支持或阻力位置的买卖点被忽略在网格之外。
来看看策略步骤
1.选股
重点行业:I 互联网和相关服务,I 软件和信息技术服务业
低估值PE小:PE<
小市值:分行业按市值排列选市值小的只
高波动:分行业在市值最小的只中选出过去一年波动率最大的5只股票
So,我们的股票池有只股。每3个月按上述条件更新一次股票池,更新时不在新股票池的亿和源码股票全部清仓。
2.网格:[-3%买,5%卖]、[-5%买,%卖]、[-8%买,%卖]、[-%买,%卖]
四种大小的网格都会相应尝试一下看看效果。
3.资金安排:在仓位控制时,满仓的概念是(总资金/股票池总数*2.5)
后面的乘数是为了提高资金利用率,因为3个月的周期内可能不是每只股票都能达到满仓。
好啦,收韭菜的时候到了
回测做了很多组,大致是分市场行情(牛、震荡和熊)各做了一次。然后在震荡期调整网格大小分别做了4次
回测详情与代码见 w(防)w(度)w(娘).joinquant.com/post/
通达信捕捉牛股利器 条件选股公式
通达信选股公式:
条件选股公式源码:
年认同价:=MA(C,);
价格中枢:=(SUM(年认同价,0)/(BARSSINCE(年认同价>0)+));
箱顶:=价格中枢*1.2;
箱底:=价格中枢*0.8;
毛利润率:=FINANCE()/FINANCE();
成长价值:=年认同价*(1+毛利润率);
收益价值:=年认同价+FINANCE();
回调认同:=EMA(EXPMA(C,),);
多头:=(回调认同>REF(回调认同,1))AND(成长价值>REF(成长价值,1))AND(收益价值>REF(收益价值,1))AND(DYNAINFO(7)>0);
回调条件:=COUNT(C<回调认同,5)>=3;
回调突破:=(REF(C,1)<=REF(回调认同,1))AND(C>回调认同)AND(回调条件)AND多头;
成长条件:=COUNT(C<成长价值,5)>=3;
成长突破:=(REF(C,1)<=REF(成长价值,1))AND(C>成长价值)AND(成长条件)AND多头;
收益条件:=COUNT(C<收益价值,5)>=3;
收益突破:=(REF(C,1)<=REF(收益价值,1))AND(C>收益价值)AND(收益条件)AND多头;
箱底条件:=COUNT(C<箱底,5)>=3;
箱底突破:=(REF(C,1)<=REF(箱底,1))AND(C>箱底)AND(箱底条件)AND多头;
价格条件:=COUNT(C<价格中枢,5)>=3;
价格突破:=(REF(C,1)<=REF(价格中枢,1))AND(C>价格中枢)AND(价格条件)AND多头;
箱顶条件:=COUNT(C<箱顶,5)>=3;
箱顶突破:=(REF(C,1)<=REF(箱顶,1))AND(C>箱顶)AND(箱顶条件)AND多头;
突破买点:(回调突破+成长突破+收益突破+箱底突破+价格突破+箱顶突破);
专买老鼠仓
{ 老鼠仓}
AA1:=AMOUNT/V;
BB1:=L<AA1*0.9;
CC1:=(C-REF(C,1))/REF(C,1)*>1.2;
DD1:=L<MA(C,5)*0.;
EE1:=V<MA(V,5)*1.5;
FF1:=BB1 AND CC1 AND DD1 AND EE1;
DRAWTEXT(FF1,(LOW* 0.),'老鼠仓'),COLORFF;
老鼠仓是个很不错的指标,信号发出一般都在一个波段的底部起涨之时。
根据本人的实践,使用指标时候要注意几点:
1 该指标可以添加到任何一个主图里面去,比如MA均线什么的。
2 出现信号当天买进股票,第二天收阳继续持股,直到出阴为止。
3 第二天出阴考虑卖出,非常适合短线操作!
老鼠仓(选股公式)
AA1:=AMOUNT/V;
BB1:=L<AA1*0.9;
CC1:=(C-REF(C,1))/REF(C,1)*>1.2;
DD1:=L<MA(C,5)*0.;
EE1:=V<MA(V,5)*1.5;
老鼠仓:BB1AND CC1 AND DD1 AND EE1;
理想选股(选股公式)
VAR1:=MA((LOW+HIGH+CLOSE)/3,5);
VAR2:=CLOSE=HHV(C,4) AND REF(C,1)=LLV(C,4);
VAR3:=REF(C,1)=LLV(C,4) AND C>=REF(C,2) OR REF(C,2)=LLV(C,4) ANDREF(C,1)<=REF(C,3) AND REF(C,2)<REF(C,4) AND C>=REF(C,1);
VAR4:=VAR1>REF(VAR1,1) AND REF(VAR1,1)<REF(VAR1,2);
VAR5:=LOW<HHV(VAR1,) AND HIGH>HHV(VAR1,) AND CLOSE>REF(C,1) ANDCLOSE>OPEN;
VAR6:=VAR5 AND COUNT(VAR4,2);
VAR7:=VAR6 AND NOT(REF(VAR6,1));
VAR8:=*EMA(EMA(C-REF(C,1),6),6)/EMA(EMA(ABS(C-REF(C,1)),6),6);
VAR9:=EMA(MA(C,),);
VAR:=FILTER((LLV(VAR8,2)=LLV(VAR8,7) AND COUNT(VAR8<0,2) ANDCROSS(VAR8,MA(VAR8,2)))=1,5);
VAR:=SMA(EMA((C-REF(C,1))/REF(C,1),5)*,3,1)*;
VAR:=FILTER(((CROSS(VAR,0) OR CROSS(C,VAR9)) AND VAR)=1,3);
VAR:=MA(C,)>=REF(MA(C,),3) AND CROSS(C,MA(C,));
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
金叉:=CROSS(J,D);
死叉:=CROSS(D,J);
买1:=(VAROR VAR) AND VAR;
买2:=(VAROR VAR) AND VAR3;
买3:=(VAROR VAR) AND VAR2;
买4:=(VAR2AND VAR) OR (VAR3 AND VAR);
买5:=(金叉AND VAR3) OR (金叉 AND VAR2) OR (金叉 AND VAR);
ST:=EXIST(C/REF(C,1)>1.,);
输出:=(买1OR 买2OR 买3OR 买4OR 买5OR VAR7) AND ST;
MA5:=MA(C,5),COLORWHITE;
X:=(3*C+L+O+H)/6;
多空线:=(*X+*REF(X,1)+*REF(X,2)+*REF(X,3)+*REF(X,4)+*REF(X,5)+*REF(X,6)
+*REF(X,7)+*REF(X,8)+*REF(X,9)+*REF(X,)+9*REF(X,)+8*REF(X,)
+7*REF(X,)+6*REF(X,)+5*REF(X,)+4*REF(X,)+3*REF(X,)+2*REF(X,)+
REF(X,))/,COLORFFFF,LINETHICK1;
AB:=DRAWLINE(HIGH>=HHV(HIGH,),HIGH,LOW<=LLV(LOW,3),HHV(HIGH,3),1),COLORYELLOW;
CROSS(MA5,多空线) and CROSS(C,AB) and 输出 ;
点石成金(选股公式)
KS:=(CLOSE-MA(CLOSE,))/MA(CLOSE,)*(-);
RSV:=(CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*;
FASTK:=SMA(RSV,3,1);K:=SMA(FASTK,3,1);D:=SMA(K,5,1);
Var1:=CLOSE/MA(CLOSE,)*<;
Var2:=CLOSE/MA(CLOSE,)*<;
Var3:=HIGH>LOW*1.;
Var4:=Var3 AND COUNT(Var3,5)>1;
Var4 AND (Var1 OR Var2) AND REF(KS,1)>= AND REF(KS,1)/KS>=1.AND
CLOSE/REF(CLOSE,1)>=1.;
牛市绝底(选股公式)
VAR1:=REF(CLOSE,1);
VAR2:=((SMA(MAX((CLOSE - VAR1),0),7,1) / SMA(ABS((CLOSE - VAR1)),7,1)) * );
VAR3:=((SMA(MAX((CLOSE - VAR1),0),,1) / SMA(ABS((CLOSE - VAR1)),,1)) *);
VAR4:=(( * (HHV(HIGH,) - LOW)) / HHV(HIGH,));
VAR5:=(( * (HIGH - LLV(LOW,))) / LLV(LOW,));
牛市绝底:VAR2< AND VAR3 < AND (VAR2 + VAR3) > AND VAR4 > ANDBARSCOUNT(CLOSE) > ;
飞弹一号(选股公式)
var1:=c/ma(c,)*<;
var2:=c/ma(c,)*<;
var3:=h>=l*1.;
var4:=var3 and count(var3,5)>=2;
xg:var4 and (var1 or var2) and count(h=l and c=o and c<ref(c,1),3)=0
and hhv(v/capital,)<0.8;
跟庄建仓源码
A:=DYNAINFO(7);
A:=BARSCOUNT(CLOSE);
A:=(SMA((CLOSE / HHV(HIGH,)),3,1) * );
A:=IF((A > ),A,0);
A:=IF((LOW > A),0,IF((HIGH < A),1,(((A - LOW) + 0.) / ((HIGH -LOW) + 0.))));
A:=DMA(A,(VOL / CAPITAL)) * ;
A:=IF((((A > 0) AND (A > REF(A,1))) AND (A <= )),A,0);
Var1:=3*SMA((CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*,5,1),3,1);
Var2:=EMA(Var1,8);
Var3:=3*SMA((C-LLV(L,))/(HHV(H,)-LLV(L,))*,5,1)-2*SMA(SMA((C-LLV(L,))/(HHV(H,)-LLV(L,))*,5,1),3,1);
趋势:=EMA(Var3,3)-;
STICKLINE(趋势>,趋势,,5,0);
DRAWICON(CROSS(趋势,0),0,1);
STICKLINE((A > 0 AND (趋势< OR 趋势>REF(趋势,1)AND趋势<)),0,A,6,0),colorFFff;
机构建仓区:0,LINETHICK0,colorFFFF;
Var4:=(趋势-REF(趋势,1))/REF(趋势,1)*;
STICKLINE(趋势<=,0,,3,0),colorcc;
DRAWTEXT(FILTER(趋势<=,),,'准备现金'),colorcc;
STICKLINE(趋势<= AND Var4>,0,,2,0),colorff;
Var5:=FILTER((趋势<= AND Var4>),);
DRAWTEXT(Var5,,'买入'),colorff;
STICKLINE(趋势>= AND Var4,0,,3,0),colorgray;
Var6:=FILTER((趋势>= AND Var4),);
DRAWTEXT(Var6,,'清仓'),colorgray;
Var7:=LLV(LOW,);
Var8:=HHV(HIGH,);
Var9:=EMA((CLOSE-Var7)/(Var8-Var7)*4,4)*;
STICKLINE(Var9>,,,3,2),COLORRED;
Var:=(Var9-LLV(Var9,4))/(HHV(Var9,4)-LLV(Var9,4))*;
DRAWTEXT(IF(CROSS(Var9,Var) AND Var9>,,0),,'险'),ColorFF;
DRAWICON(CROSS(,Var9),,9);
Var:=SMA(ABS(L-REF(L,1)),3,1)/SMA(MAX(L-REF(L,1),0),3,1)*;
Var:=HHV(Var,)*8;
火焰山:EMA(IF(LOW<=Var7AND 趋势<,(Var+Var),0),3)/,COLORRED,linethick2;
STICKLINE(火焰山>0,0 ,火焰山*1.2,4,0 ),COLORRED;
Var:=(MA(C,1)+MA(C,3)+MA(C,5)+MA(C,7)+MA(C,9))/5;
Var:=(MA(C,2)+MA(C,4)+MA(C,6)+MA(C,8)+MA(C,))/5;
趋势线:趋势,colorff;
Var:=MAX(EMA(Var,2)-EMA(Var,5),0)*;
Var:=EMA(Var,5);
波浪峰:Var,stick,colorffff;
STICKLINE(Var<REF(Var,1),0,Var,1,0),colorff;
Var:=MA(趋势线,8);
if(CROSS(Var2,Var) AND Var2<,,0),COLORRED;
DRAWTEXT(CROSS(趋势线,Var2)AND 趋势线>REF(趋势线,1)AND 趋势线<,,'追涨'),COLORffff;
风险区:IF(趋势>,趋势,),colorffff;
双信号"全仓"选股(选股公式)
FF:=EMA(CLOSE,3);
MA:=EMA(CLOSE,);
TTJ:=CROSS(FF,MA);
上:=EMA(C,3),COLORBLUE,LINETHICK1;
中:=EMA(C,5),COLORWHITE,LINETHICK1;
下:=EMA(中,5),COLORFF,LINETHICK1;
QQ:= C<中;
MM:=上>REF(上,1)AND REF(上,1)<REF(上,2) ;
V1:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,))/MA(CLOSE,);
V2:=(1-7/)*(DMA(CLOSE,V1));
V3:=(1+7/)*(DMA(CLOSE,V1));
V5:=MA((LOW+HIGH+CLOSE)/3,5);
MA1:=MEMA(CLOSE,5);
MA2:=ATAN((MA1/REF(MA1,1)-1)*)*/3.;
MA3:=IF(MA2>0,MA2,MA2);
MA5:=MA(CLOSE,5),COLOR;
MA:=MA(CLOSE,),COLORFFF0,LINETHICK2;
VAR:=CLOSE=HHV(C,4) AND (REF(C,1)>=REF(C,2) OR REF(C,1)>=REF(C,3))
OR REF(C,1)=HHV(C,4) AND CLOSE>=REF(C,2) OR REF(C,2)=HHV(C,4) AND
REF(C,3)=LLV(C,4) AND C>=REF(C,1) OR REF(C,3)=HHV(C,4) AND
C>=REF(C,1) AND C>=REF(C,2);
{ 收盘价=4日内收盘价的最高值AND 昨收>=2日前的收盘价}
VAR:=CLOSE=HHV(C,4) AND REF(C,1)=LLV(C,4);
{ 收盘价=4日内收盘价的最高值AND 昨收=4日内收盘价的最低值}
VAR:=CLOSE=LLV(C,4) AND (REF(C,1)<REF(C,2) OR REF(C,1)<REF(C,3)) OR
REF(C,1)=LLV(C,4) AND C<REF(C,2) OR REF(C,2)=LLV(C,4) AND
REF(C,1)=HHV(C,4) AND C<REF(C,1) OR REF(C,3)=LLV(C,4) AND
C<REF(C,1) AND C<REF(C,2);
{ 收盘价=4日内收盘价的最低值AND (昨收<2日前的收盘价}
VAR:=REF(C,1)=LLV(C,4) AND C>=REF(C,2) OR REF(C,2)=LLV(C,4) AND
REF(C,1)<=REF(C,3) AND REF(C,2)<REF(C,4) AND C>=REF(C,1);
{ 昨收=4日内收盘价的最低值AND 收盘价>=2日前的收盘价}
VAR:=REF(C,1)=HHV(C,4) AND C<REF(C,2) OR (REF(C,2)=HHV(C,4) AND
REF(C,1)>REF(C,3) OR REF(C,3)=HHV(C,4) AND REF(C,1)>REF(C,2)) AND
REF(C,2)>=REF(C,4) AND C<REF(C,1);
{ 昨收=4日内收盘价的最高值AND 收盘价<2日前的收盘价}
VAR:=V5>REF(V5,1) AND REF(V5,1)<REF(V5,2);
{ 今日V5向上形成拐点}
VAR:=LOW<HHV(V5,) AND HIGH>HHV(V5,) AND CLOSE>REF(C,1) ANDCLOSE>OPEN;
VAR:=VAR AND COUNT(VAR,2);
VAR:=*EMA(EMA(C-REF(C,1),6),6)/EMA(EMA(ABS(C-REF(C,1)),6),6);
VAR:=EMA(MA(C,),);
VAR:=FILTER((LLV(VAR,2)=LLV(VAR,7) AND COUNT(VAR<0,2) AND
CROSS(VAR,MA(VAR,2)))=1,5);
VAR:=FILTER((HHV(VAR,2)=HHV(VAR,7) AND COUNT(VAR>,2) AND
CROSS(MA(VAR,2),VAR))=1,1);
VAR:=SMA(EMA((C-REF(C,1))/REF(C,1),5)*,3,1)*;
VAR:=FILTER(((CROSS(VAR,0) OR CROSS(C,VAR)) AND VAR)=1,3);
VAR:=MA(C,)>=REF(MA(C,),3) AND CROSS(C,MA(C,));
VAR:=VAR AND NOT(REF(VAR,1));
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
金叉:=CROSS(J,D);
死叉:=CROSS(D,J);
买1:=(VAROR VAR) AND VAR;
买2:=(VAROR VAR) AND VAR;
买3:=(VAROR VAR) AND VAR;
买4:=(VARAND VAR) OR (VAR AND VAR);
买5:=(金叉AND VAR) OR (金叉 AND VAR) OR (金叉 AND VAR);
TTJ0:=VAR;
TTJ1:=买1OR 买2OR 买3OR 买4OR 买5AND MM;
XG0:=TTJ AND TTJ0;
XG1:=TTJ AND TTJ1;
XG:=XG0 OR XG1;
{ 以下波浪理论浪底重叠"买底"选股原码}
PL5:=ZIG(3,5);
EN1:=ZIG(3,5)>REF(ZIG(3,5),1) AND REF(ZIG(3,5),1)<=REF(ZIG(3,5),2) ANDREF(ZIG(3,5),2)<=REF(ZIG(3,5),3);
EX1:=ZIG(3,5)<REF(ZIG(3,5),1) AND REF(ZIG(3,5),1)>=REF(ZIG(3,5),2) ANDREF(ZIG(3,5),2)>=REF(ZIG(3,5),3);
PL:=ZIG(3,);
EN2:=ZIG(3,)>REF(ZIG(3,),1) AND REF(ZIG(3,),1)<=REF(ZIG(3,),2)AND REF(ZIG(3,),2)<=REF(ZIG(3,),3);
EX2:=ZIG(3,)<REF(ZIG(3,),1) AND REF(ZIG(3,),1)>=REF(ZIG(3,),2)AND REF(ZIG(3,),2)>=REF(ZIG(3,),3);
PL:=ZIG(3,);
EN3:=ZIG(3,)>REF(ZIG(3,),1) AND REF(ZIG(3,),1)<=REF(ZIG(3,),2)AND REF(ZIG(3,),2)<=REF(ZIG(3,),3);
EX3:=ZIG(3,)<REF(ZIG(3,),1) AND REF(ZIG(3,),1)>=REF(ZIG(3,),2)AND REF(ZIG(3,),2)>=REF(ZIG(3,),3);
PL:=ZIG(3,);
走强1:=BARSLAST(PL5<REF(PL5,1));
走弱1:=BARSLAST(PL5>REF(PL5,1));
走强2:=BARSLAST(PL<REF(PL,1));
走弱2:=BARSLAST(PL>REF(PL,1));
走强3:=BARSLAST(PL<REF(PL,1));
走弱3:=BARSLAST(PL>REF(PL,1));
ZTJZ5:=IF(PL>REF(PL,1),COUNT(EN1,走强2),0);
ZTJD5:=IF(PL>REF(PL,1),COUNT(EX1,走强2),0);
DTJZ5:=IF(PL<REF(PL,1),COUNT(EN1,走弱2),0);
DTJD5:=IF(PL<REF(PL,1),COUNT(EX1,走弱2),0);
ZTJZ:=IF(PL>REF(PL,1),COUNT(EN2,走强3),0);
ZTJD:=IF(PL>REF(PL,1),COUNT(EX2,走强3),0);
DTJZ:=IF(PL<REF(PL,1),COUNT(EN2,走弱3),0);
DTJD:=IF(PL<REF(PL,1),COUNT(EX2,走弱3),0);
TJ:=EN2 AND ZTJZ5=1;
TJ:=EN1 AND PL>REF(PL,1) AND ZTJZ5=2;
TJ:=EN2 AND DTJZ=1;
TJ:=EN3 AND ZTJZ=1;
TJ:=EN2 AND PL>REF(PL,1) AND ZTJZ=2;
XG:=TJ OR TJ OR TJ OR TJ OR TJ;
{ 以下二者结合共同选股}
XG:=XG OR XG;
W:EXIST(XG,1);
量化交易 | 网格交易大法
网格交易是一种仓位策略,用于动态调整仓位。其核心原则是“仓位策略比选股策略更重要”。以下是网格交易的基本概念、特点与局限、策略步骤、回测结果与结论,以及策略源码。
基本概念:
1. 底仓价:作为建仓与调仓的重要依据。
2. 低吸高抛:根据网格设置买卖价位,避免追涨杀跌。
3. 网格大小:买入网格小于卖出网格,旨在捕捉利润。
特点与局限:
1. 没有万能策略,趋势决定策略成败。
2. 选股应集中在波动大、成长性好的中小市值股票。
3. 底仓价格设定需在安全边际内,避免估值顶部建仓。
4. 在牛市中策略表现可能不佳,分散仓位可能导致阿尔法较低。
5. 买卖规则较为固定,可能忽略重要突破点。
策略步骤:
1. 选股:重点关注互联网和软件信息服务业,PE小于,市值小,波动率高。
2. 网格设置:[-3%买,5%卖]、[-5%买,%卖]、[-8%买,%卖]、[-%买,%卖]。
3. 资金安排:在仓位控制时,满仓概念为总资金除以股票池总数乘以2.5,提高资金利用率。
回测结果与
1. 熊市中大网格表现较好,震荡期小网格效果更优,长周期中网格策略效果显著。
2. 最佳结果包括:熊市盈利%,长周期%,震荡期%,年化回报率分别为%、%、.6%。
3. 策略源码提供了执行流程,包括行业筛选、股票选择、网格交易执行与调整。