文章目录:
请高手优化通达信指标公式使小红箭头发出信号少一点
朋友,指标我已经帮你调整了,现在信号少了一大半,你试下如何:
AAA2:=SUM(IF( CLOSEREF(CLOSE,1),VOL*C,0),0);
AAA3:=SUM(IF( CLOSEREF(CLOSE,1),VOL*C,0),0);
AAA4:=SUM(IF( CLOSE=REF(CLOSE,1),VOL*C,0),0);
BB1:=0;
B1万元:=DVOL*DCLOSE/100;
B1差:=B1万元-REF(B1万元,1);
B2万元:=DVOL*DCLOSE/100;
B2比:=B2万元/REF(B2万元,1);
净流入万元:=(AAA2-AAA3-0.5*AAA4);
PM:=MA(净流入万元,1);
PMA:=PM/REF(PM,1)1;
PMB:=REF(PMA,1)1 AND PMA;
密码:(EMA(MA(B1万元,2),2))/100000,COLORYELLOW,NODRAW;
二日比:=密码/REF(密码,1);
选股:PMB AND 密码REF(密码,1) AND 二日比1.5,COLORRED,NODRAW;
MA5:MA(C,5);MA10:MA(C,10);MA30:MA(C,30);
DRAWNUMBER(选股=1 ,L,密码),COLORYELLOW;
DRAWICON(选股,L*0.975,1);
公式源码如下,请高手帮忙改成选股公式,谢谢! 选股发出“选股买点”信号,谢谢!!
VAR3:=LLV(HIGH,240);
VAR4:=100*(CLOSE-VAR3)/VAR3;
VAR5:=(CLOSE-LLV(LOW,528))/(HHV(HIGH,528)-LLV(LOW,528))*100;
VAR6:=(CLOSE-LLV(CLOSE,530))/(HHV(CLOSE,530)-LLV(CLOSE,530))*100;
VAR8:=SMA(MAX(CLOSE-REF(CLOSE,1),0),34,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),7,1)*100;
VAR9:=SMA(MAX(CLOSE-REF(CLOSE,1),0),13,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),13,1)*100;
VARA:=BARSCOUNT(CLOSE);
VARB:=VAR820 AND VAR923 AND VARA35;
VARC:=VARB AND COUNT(VARB,1)=1;
VARD:=EMA(CLOSE,21)-EMA(CLOSE,8);
VARE:=EMA(VARD,5);
VARF:=TROUGHBARS(3,6,1)4 AND CROSS(VARD,VARE);
选股买点: IF(TROUGHBARS(3,16,1)=0 AND HIGHLOW+0.04,4,0);
至于公式其他信号,不要使用,因为带有大量的未来函数计算。
请教,选股公式源码如何在分析软件中用?
第七讲从源码中提取选股公式
要点:从后往前找,删除没用条,去掉修饰符,个别加等号。
例一:找出买点
VAR1:=(((HHV(HIGH,36) - CLOSE) / (HHV(HIGH,36) - LLV(LOW,36))) * 100);
VAR2:=SMA(VAR1,5,1);
VAR3:=SMA(VAR2,8,1);
H1:EMA(CLOSE,8),LINETHICK1;
H2:EMA(H1,20),LINETHICK1;
VAR4:=(CROSS(VAR2,VAR3) AND (VAR3 20));
VAR5:=((CLOSE (LLV(CLOSE,60) + (0.3 * LLV(CLOSE,60)))) AND VAR4);
VAR6:=IF((CLOSE 1000),VAR4,VAR5);
M1:EMA(CLOSE,60);
M2:EMA(CLOSE,89);
M3:EMA(CLOSE,233),LINETHICK1;
M4:EMA(CLOSE,583),LINETHICK1;
STICKLINE((H1 H2),H1,H2,1,0.8);
STICKLINE((H1 H2),H1,H2,1,0.8);
DRAWTEXT((CROSS(H1,H2) AND (CLOSE EMA(CLOSE,60))),(LOW * 0.92),'买');
DRAWTEXT(VAR6,(HIGH * 1.08),'卖');
分解说明:
VAR1:=(((HHV(HIGH,36) - CLOSE) / (HHV(HIGH,36) - LLV(LOW,36))) * 100);
VAR2:=SMA(VAR1,5,1);
VAR3:=SMA(VAR2,8,1);
H1:EMA(CLOSE,8),LINETHICK1;
H2:EMA(H1,20),LINETHICK1;
VAR4:=(CROSS(VAR2,VAR3) AND (VAR3 20));
VAR5:=((CLOSE (LLV(CLOSE,60) + (0.3 * LLV(CLOSE,60)))) AND VAR4);
VAR6:=IF((CLOSE 1000),VAR4,VAR5);
M1:EMA(CLOSE,60);
M2:EMA(CLOSE,89);
M3:EMA(CLOSE,233),LINETHICK1;
M4:EMA(CLOSE,583),LINETHICK1;
STICKLINE((H1 H2),H1,H2,1,0.8);
STICKLINE((H1 H2),H1,H2,1,0.8);
第一步{从后往前找}找到下面这行“买”的输出语句。然后看这条语句的基本条件。
DRAWTEXT((CROSS(H1,H2) AND (CLOSE EMA(CLOSE,60))),(LOW * 0.92),'买');
查看结果:输出文字 交叉 条件,条件 直 接 输 出 语 句 输出位置 文字
DRAWTEXT(VAR6,(HIGH * 1.08),'卖');
知道“基本条件”为 H1,H2,那么与此没有任何关系的语句从后往前删除。删的办法有两种:一是直接删掉;二是先用{}括上,待没问题时再一次性删除。加蓝色的为找到的不输出语句。
第二步{删除没用条}后,剩下的有用语句:
H1:EMA(CLOSE,8),LINETHICK1; {加蓝的为修饰类函数,原则一律删除。}
H2:EMA(H1,20),LINETHICK1;
DRAWTEXT((CROSS(H1,H2) AND (CLOSE EMA(CLOSE,60))),(LOW * 0.92),'买');
第三步{去掉修饰符} 分别去掉:指标线粗细、显示文字、文字位置函数和文字
H1:EMA(CLOSE,8);
H2:EMA(H1,20);
CROSS(H1,H2) AND CLOSE EMA(CLOSE,60);
第四步{个别加等号} 条件选股只能输出一条语句,上面这三行为全部输出,所以,作为“条件”的前两行还必须在冒号后面加上等号,表达不输出。结果:
H1:=EMA(CLOSE,8);
H2:=EMA(H1,20);
CROSS(H1,H2) AND CLOSE EMA(CLOSE,60);
例二、找出笑脸和买入信号
以本人发过的《跟庄建仓》为例。
A01:=DYNAINFO(7);
A03:=BARSCOUNT(CLOSE);
A04:=(SMA((CLOSE / HHV(HIGH,120)),3,1) * 100);
A05:=IF((A03 20),A04,0);
A06:=IF((LOW A01),0,IF((HIGH A01),1,(((A01 - LOW) + 0.009) / ((HIGH - LOW) + 0.009))));
A07:=DMA(A06,(VOL / CAPITAL)) * 60;
A09:=IF((((A07 0) AND (A07 REF(A07,1))) AND (A05 = 88)),A07,0);
Var1:=3*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1),3,1);
Var2:=EMA(Var1,8);
Var3:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);
趋势:=EMA(Var3,3)-10;
FILLRGN(趋势80,趋势,80);
DRAWICON(CROSS(趋势,0),0,1);
FILLRGN((A09 0 AND (趋势20 OR 趋势REF(趋势,1)AND 趋势50)),0,A09),colorFFFF00;
机构建仓区:0,LINETHICK0,colorFFFF00;
Var4:=(趋势-REF(趋势,1))/REF(趋势,1)*100;
STICKLINE(趋势=13,0,20,5,0),colorcc9900;
DRAWTEXT(FILTER(趋势=13,15),30,'准备现金'),colorcc9900;
STICKLINE(趋势=13 AND Var413,0,50,5,0),color0099ff;
Var5:=FILTER((趋势=13 AND Var413),10);
DRAWTEXT(Var5,60,'买入'),color0099ff;
STICKLINE(趋势=90 AND Var4,0,30,5,0),colorgray;
Var6:=FILTER(趋势=90,10);
DRAWTEXT(Var6,40,'清仓'),colorgray;
Var7:=LLV(LOW,30);
Var8:=HHV(HIGH,30);
Var9:=EMA((CLOSE-Var7)/(Var8-Var7)*4,4)*25;
STICKLINE(Var990,100,105,10,2),COLORRED;
STICKLINE(CROSS(Var4,-40),10,55,6,0),COLORRED;
Var10:=(Var9-LLV(Var9,4))/(HHV(Var9,4)-LLV(Var9,4))*100;
DRAWTEXT(IF(CROSS(Var9,Var10) AND Var987,95,0),88,'险'),Color00FF00,ALIGN1;
DRAWICON(CROSS(90,Var9),95,9);
Var11:=SMA(ABS(L-REF(L,1)),3,1)/SMA(MAX(L-REF(L,1),0),3,1)*100;
Var12:=HHV(Var11,30)*8;
火焰山:EMA(IF(LOW=Var7 AND 趋势40,(Var11+Var12),0),3)/618,COLORRED,linethick2;
STICKLINE(火焰山0,0 ,火焰山*1.2,8,0 ),COLORRED;
Var13:=(MA(C,1)+MA(C,3)+MA(C,5)+MA(C,7)+MA(C,9))/5;
Var14:=(MA(C,2)+MA(C,4)+MA(C,6)+MA(C,8)+MA(C,10))/5;
趋势线: 趋势,colorff0000;
Var16:=MAX(EMA(Var13,2)-EMA(Var14,5),0)*200;
Var17:=EMA(Var16,5);
波浪峰:Var17,stick,colorff00ff;
STICKLINE(Var17REF(Var17,1),0,Var17,1,0),color00ff00;
Var18:=MA(趋势线,8);
if(CROSS(Var2,Var18) AND Var215,50,0),COLORRED;
DRAWTEXT(CROSS(趋势线,Var2)AND 趋势线REF(趋势线,1)AND 趋势线50,50,'追涨'),COLORFF0000;
分析:这个公式输出语句非常多,但多数都是用于趋势判断的。所以不用管它。仍按我们既定的思路进行。
第一步{从后往前找},先删除发出信号关键语句之后的(红色为输出语句,它以下的语句已经删去,蓝色为等待下步删除的)
A01:=DYNAINFO(7);
A03:=BARSCOUNT(CLOSE);
A04:=(SMA((CLOSE / HHV(HIGH,120)),3,1) * 100);
A05:=IF((A03 20),A04,0);
A06:=IF((LOW A01),0,IF((HIGH A01),1,(((A01 - LOW) + 0.009) / ((HIGH - LOW) + 0.009))));
A07:=DMA(A06,(VOL / CAPITAL)) * 60;
A09:=IF((((A07 0) AND (A07 REF(A07,1))) AND (A05 = 88)),A07,0);
Var1:=3*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1),3,1);
Var2:=EMA(Var1,8);
Var3:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);
趋势:=EMA(Var3,3)-10;
FILLRGN(趋势80,趋势,80);
DRAWICON(CROSS(趋势,0),0,1);
FILLRGN((A09 0 AND (趋势20 OR 趋势REF(趋势,1)AND 趋势50)),0,A09),colorFFFF00;
机构建仓区:0,LINETHICK0,colorFFFF00;
Var4:=(趋势-REF(趋势,1))/REF(趋势,1)*100;
STICKLINE(趋势=13,0,20,5,0),colorcc9900;
DRAWTEXT(FILTER(趋势=13,15),30,'准备现金'),colorcc9900;
STICKLINE(趋势=13 AND Var413,0,50,5,0),color0099ff;
Var5:=FILTER((趋势=13 AND Var413),10);
DRAWTEXT(Var5,60,'买入'),color0099ff;
第二步{删除没用条}后
Var3:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);
趋势:=EMA(Var3,3)-10;
DRAWICON(CROSS(趋势,0),0,1);
Var4:=(趋势-REF(趋势,1))/REF(趋势,1)*100;
Var5:=FILTER((趋势=13 AND Var413),10);
DRAWTEXT(Var5,60,'买入'),color0099ff;
第三步{去掉修饰符后}:
趋势:=EMA(Var3,3)-10;
CROSS(趋势,0);
Var4:=(趋势-REF(趋势,1))/REF(趋势,1)*100;
Var5:=FILTER((趋势=13 AND Var413),10);
Var5;
第四步{个别加等号}本公式中的“条件”语句都是不输出的,所以此项省略,但因是要笑脸和买入两个信号,所以还必须把它们连结起来:
Var3:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);
趋势:=EMA(Var3,3)-10;
Var4:=(趋势-REF(趋势,1))/REF(趋势,1)*100;
Var5:=FILTER((趋势=13 AND Var413),10);
CROSS(趋势,0)or Var5;
江南茶外汇
请问老师?
我的软件是银河双子星 我在写习题:10日均线与20日均线金叉和涨幅超过百分之三,且成交量比昨天放大一倍。时做了如下操作:
1,MA1:=MA(CLOSE,10);MA2:=MA(CLOSE,20);CROSS(MA1,MA2);
2,C:=CLOSE/REF(CLOSE,1)3/100;
3,V:=VOL/REF(VOL,1)2;
4,CROSS(MA1,MA2)ANDCLOSE/REF(CLOSE,1)3/100AND(VOL/VOL,1)2;
但我完成测试时电脑不给通过 上面提示说"行2:缺少;"
请问我是哪里错了?谢谢!
大庆老杨
以这个题目讲解一下。
1、收盘价等专用函数如(C,O,H,L,V,AND,OR)是不能作为引导语句的。
2、后面输出和前面交待的条件多处重复。
整理后的:
MA1:=MA(CLOSE,10);
MA2:=MA(CLOSE,20);
CROSS(MA1,MA2)ANDCLOSE/REF(CLOSE,1)3/100 AND VOL/(VOL,1)2;
或者:
MA1:=MA(CLOSE,10);
MA2:=MA(CLOSE,20);
AA:=CROSS(MA1,MA2);
BB:=CLOSE/REF(CLOSE,1)3/100;
VV:=VOL/REF(VOL,1)2;
AA AND BB AND VV;
编写公式如同做数学题,要有一个反复领会和实践的过程,不能指望一蹴而就。
没事时打开公式编辑器,从简单的入手,编几个,看看图形,慢慢就会,熟能生巧。
号后面加上等号,表达不输出。结果:H1:=EMA(CLOSE,8);H2:=EMA(H1,20);CROSS(H1,H2) AND CLOSE EMA(CLOSE,60);例二、找
CLOSE,60);例二、找出笑脸和买入信号以本人发过的《跟庄建仓》为例。A01:=DYNAINFO(7);A03:=BARSCOUNT(CLOSE);A04:=(SMA((C
请高手优化通达信指标公式使小红箭头发出信号少一点朋友,指标我已经帮你调整了,现在信号少了一大半,你试下如何:AAA2:=SUM(IF( CLOSEREF(CLOSE,1),VOL*C,0)
R(趋势=90,10);DRAWTEXT(Var6,40,'清仓'),colorgray;Var7:=LLV(LOW,30);Var8:=HHV(HIGH,30); Var9:=EMA((CLOSE-Var7)/(Var8-Var7)*4,4)*25; STICKLI
D 密码REF(密码,1) AND 二日比1.5,COLORRED,NODRAW;MA5:MA(C,5);MA10:MA(C,10);MA30:MA(C,30);DRAWNUMBER(选股=1 ,L,密码),COLO