主图、自动画短期箱体、压力支撑、含有准未来函数BACKSET 向前赋值、(源码、贴图)介绍
主图、自动画短期箱体、压力支撑、含有准未来函数BACKSET 向前赋值、(源码、贴图)
1、公式名称:使用者可随意自取。
2、公式源码:
m2:MA(C,2),COLORRED,LINETHICK1;
m5:MA(C,5),PRECIS2,LINETHICK2;
m20:MA(C,20),PRECIS2,LINETHICK1;
m60:MA(C,60),PRECIS2,LINETHICK1;
AA:=CLOSE>REF(CLOSE,1) AND REF(CLOSE,1)>REF(CLOSE,2) AND REF(CLOSE,1)<REF(CLOSE,3) AND IF(REF(CLOSE,3)<REF(CLOSE,4),1,IF(REF(CLOSE,4)<REF(CLOSE,5),REF(CLOSE,1)<REF(CLOSE,4) OR (REF(CLOSE,2)<REF(CLOSE,4) AND REF(CLOSE,3)>=REF(CLOSE,5)),IF(REF(CLOSE,5)<REF(CLOSE,6),1,REF(CLOSE,6)<REF(CLOSE,7))));
DRAWTEXT(AA AND CLOSE>REF(OPEN,2),LOW*0.98,'↑'),COLORYELLOW;
BB:=CLOSE<REF(CLOSE,1) AND REF(CLOSE,1)<REF(CLOSE,2) AND REF(CLOSE,1)>REF(CLOSE,3) AND IF(REF(CLOSE,3)>REF(CLOSE,4),1,IF(REF(CLOSE,4)>REF(CLOSE,5),REF(CLOSE,1)>REF(CLOSE,4) OR (REF(CLOSE,2)>REF(CLOSE,4) AND REF(CLOSE,3)<=REF(CLOSE,5)),IF(REF(CLOSE,5)>REF(CLOSE,6),1,REF(CLOSE,6)>REF(CLOSE,7))));
DRAWTEXT(BB AND CLOSE<REF(CLOSE,2),HIGH*1.02,'↓'),COLOR00FF00;
MA18:=MA(CLOSE,18);
VAR1:=C=HHV(C,4) AND REF(C,1)=LLV(C,4);
VAR2:=C=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);
VAR3:=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);
A:=(3*C+L+O+H)/6;
VAR4:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+
14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12)
+7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+REF(A,20))/210;
MTM:=C-REF(C,1);
DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
CB:=EMA(VAR4,13);
STICKLINE(VAR3,O,(O+C)/2,3,0),COLOR00FFFF,LINETHICK7;
STICKLINE(VAR3,O,(O+C)/2,0.5,0),COLOR00FFFF,LINETHICK7;
NN:= DISPSTATUS=2;
A1:=REF(HIGH,3)=HHV(HIGH,2*3+1);
B1:=FILTER(A1,3);
C1:=BACKSET(B1,3+1);
D1:=FILTER(C1,3);
A2:=REF(LOW,3)=LLV(LOW,2*3+1);
B2:=FILTER(A2,3);
C2:=BACKSET(B2,3+1);
D2:=FILTER(C2,3);
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
E2:=(HIGH+LOW)/2;
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS OR BARSCOUNT(CLOSE)=1;
L1:=(D2 AND NOT(D1 AND E1=E2));
X1:=REF(BARSLAST(H1),1)+1;
F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1);
I1:=BACKSET(G1,2);
LD:=I1>REF(I1,1);
L2:=LD OR BARSTATUS OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2 AND COUNT(H1,X2)>0,HHVBARS(IF(H1,HIGH,0),X2));
G2:=F2>REF(F2,1);
I2:=BACKSET(G2,2);
HD:=I2>REF(I2,1);
UU:=BACKSET(BARSTATUS,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
UU2:=BACKSET(BARSTATUS,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
上:REF(H,BARSLAST(XX2)),PRECIS2,Color0000FF,LINETHICK1;
压:REF(H,BARSLAST(VV2)),PRECIS2,Color0000FF,LINETHICK1,DOTLINE;
支:REF(L,BARSLAST(VV)),PRECIS2,COLORYELLOW,LINETHICK1,DOTLINE;
下:REF(L,BARSLAST(XX)),COLORYELLOW,PRECIS2,LINETHICK1;
DRAWTEXT(nn,支,'支: '+NUMTOSTRN(支,2)+'元'),ALIGN2,COLORYELLOW,VALIGN0,LINETHICK1;
DRAWTEXT(nn,压,'压: '+NUMTOSTRN(压,2)+'元'),ALIGN2,COLORYELLOW,VALIGN2,LINETHICK1;
DRAWTEXT(nn,下,'下: '+NUMTOSTRN(下,2)+'元'),ALIGN2,COLORYELLOW,LINETHICK1,VALIGN0;
DRAWTEXT(nn,上,'上: '+NUMTOSTRN(上,2)+'元'),ALIGN2,COLORYELLOW,LINETHICK1,VALIGN2;
DRAWTEXTREL(10,60,'所属板块:'+BKNAME),ColorAFFF00;
3、准未来函数说明:
BACKSET 向前赋值
将当前位置到若干周期前的数据设为1。
用法: BACKSET(X,N) 若X非0,则将当前位置到N周期前的数值设为1。
例如: BACKSET(CLOSE>OPEN,2) 若收阳则将该周期及前一周期数值设为1,否则为0。
这个准未来函数只不过是一个画线用的,现主图中其他的信号无关,并不会引起信号飘移的现象。其实这个自动画线也就是方便一下不会自画线的新手。
4、指标使用说明:
因本人短线操作,所以在公式中只是使用2、5、20、60这四条均线,如果其他想做中长线的同学,可以自行增加或删减均线。这个主图在使用时,配合MACD指标,当2、5日线与MACD指标的两条线同时出现“金叉”或“死叉”时,也就是短线操作买卖的最佳时机了。
这个公式如果使用的同学原封不动的套用的话,在配合MACD指标的时候,建议把MACD指标的参数设置为5、10、20;这样就可以使MACD指标不过于灵敏,也不过于滞后。
5、上图:
gd14663