飞狐包容压力支撑时间窗及背离公式
源码
H1:hhv(high,11)*(1-4/100),COLORwhite,linethick4;
H2:hhv(high,2)*(1-4/100),COLORblue,linethick1;
{卖线:EMA(SLOPE(C,21)*21+C,42),COLORRED,LINETHICK2;}
Var2:=简单移动平均(收盘价, 5);
Var3:=简单移动平均(收盘价, 10);
Var4:=简单移动平均(收盘价, 20);
Var5:=简单移动平均(收盘价, 30);
Var6:=(Var2+Var3+Var4+Var5)/4;
Var7:=(Var6-向前引用(Var6, 15))/向前引用(Var6,15)*100;
Var8:=(Var6-向前引用(Var6, 15))/向前引用(Var6, 15)*100;
Var9:=指数平滑移动平均(Var7, 8);
反转:画柱线(Var9>1*向前引用(Var9, 1), 最高价,最低价,0.5,0), COLORwhite;
画柱线(Var9>1*向前引用(Var9, 1), 开盘价,收盘价,5,1), COLORwhite;
持股:画柱线(Var7>1*向前引用(Var7, 1), 最高价,最低价,0.5,0), COLORRED;
画柱线(Var7>1*向前引用(Var7, 1), 开盘价,收盘价,5,1), COLORRED;
持币:画柱线(Var7<1*向前引用(Var7, 1),最高价,最低价,0.5,0 );
画柱线(Var7<1*向前引用(Var7, 1), 开盘价,收盘价,5,1);
洗盘:画柱线(Var7<1*向前引用(Var7, 1) AND Var9>1*向前引用(Var9, 1),最高价,最低价,0.5,0 ), COLORF00FF0;
画柱线(Var7<1*向前引用(Var7, 1) AND Var9>1*向前引用(Var9, 1), 开盘价,收盘价,5,1), COLORF00FF0;
平均价:=(最高价+4*最低价+开盘价+收盘价)/7;
均价差:= 指数平滑移动平均(平均价,13) - 指数平滑移动平均(平均价,34);
移动均价:= 指数平滑移动平均(均价差,5);
差:=(均价差-移动均价)*5;
A:=条件函数(差>=1000 ,1000 ,条件函数(差<=平均价,平均价,差) );
分水岭:=线性回归预测值(线性回归预测值(A,31),10);
{分:forcast(forcast(A,31),10),linethick1,colorffff00;}
ma6:=简单移动平均(收盘价,6);
ma18:=简单移动平均(收盘价,18);
ma55:=简单移动平均(收盘价,55);
ma125:=简单移动平均(收盘价,125);
ma250:=简单移动平均(收盘价,250);
TY:=收盘价;
A1:=向前引用(TY,10)=最高值(TY,2*10+1); B1:=信号过滤(A1,10); C1:=向前赋值(B1,10+1); HD:=信号过滤(C1,10);
A2:=向前引用(TY,10)=最低值(TY,2*10+1); B2:=信号过滤(A2,10); C2:=向前赋值(B2,10+1); LD:=信号过滤(C2,10);
AA:=向前引用(收盘价,上一次条件成立位置(HD)); B:=向前引用(收盘价,上一次条件成立位置(LD));
t11:=上一次条件成立位置(HD)<上一次条件成立位置(LD) AND 求逻辑非(HD) ;
t21:=上一次条件成立位置(HD)>上一次条件成立位置(LD) AND 求逻辑非(LD);
波峰:条件函数(t11,AA,AA),ColorFF00FF,点状线;
画柱线(t11,AA,AA,9,0),ColorFF00FF;
波谷:条件函数(t21,B,B),Color80FF00,点状线;
画柱线(t21,B,B,9,0),Color80FF00;
买进价:=((收盘价-向前引用(ma6,1))/6+ma6)*1.004;
买进条件:=交叉函数(收盘价,买进价) and 买进价>向前引用(买进价,1);
白买进:条件函数(买进条件,最低价,最高价),COLORWHITE,点状线;
画柱线(买进条件,最高价,最低价,0,1),colorwhite,linethick2;
画柱线(买进条件,开盘价,收盘价,4,1),colorwhite,linethick2;
加码价:=((收盘价-向前引用(ma18,1))/18+ma18)*1.004;
加码条件:=交叉函数(收盘价,加码价) and 加码价>向前引用(加码价,1);
黄加码:条件函数(加码条件,最低价,最高价),coloryellow,点状线;
画柱线(加码条件,最高价,最低价,0,1),coloryellow,linethick2;
画柱线(加码条件,开盘价,收盘价,4,1),coloryellow,linethick2;
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
DRAWICON(FILTER(B1>0,5),L*0.94,10);
DRAWTEXT(FILTER(B1>0,5),L*0.94,'M底'),COLORGREEN;{MACD底背离}
A2:=BARSLAST(REF(CROSS("KDJ.K","KDJ.D"),1));
B2:=REF(C,A2+1)>C AND REF("KDJ.K",A2+1)<"KDJ.K" AND CROSS("KDJ.K","KDJ.D");
DRAWICON(FILTER(B2>0,5),L*0.96,10);
DRAWTEXT(FILTER(B2>0,5),L*0.96,'K底'),COLORYELLOW;{KDJ底背离}
A3:=BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1));
B3:=REF(C,A3+1)>C AND REF("RSI.RSI1",A3+1)<"RSI.RSI1" AND CROSS("RSI.RSI1","RSI.RSI2");
DRAWICON(FILTER(B3>0,5),L*0.98,10);
DRAWTEXT(FILTER(B3>0,5),L*0.98,'R底'),COLORCYAN;{RSI底背离}
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
DRAWICON(FILTER(D1>0,5),H*1.07,12);
DRAWTEXT(FILTER(D1>0,5),H*1.07,'M顶'),COLOR0066FF;{MACD顶背离}
C2:=BARSLAST(REF(CROSS("KDJ.D","KDJ.K"),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K",C2+1)>"KDJ.K" AND CROSS("KDJ.D","KDJ.K");
DRAWICON(FILTER(D2>0,5),H*1.05,12);
DRAWTEXT(FILTER(D2>0,5),H*1.05,'K顶'),COLORRED;{KDJ顶背离}
C3:=BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1",C3+1)>"RSI.RSI1" AND CROSS("RSI.RSI2","RSI.RSI1");
DRAWICON(FILTER(D3>0,5),H*1.03,12);
DRAWTEXT(FILTER(D3>0,5),H*1.03,'R顶'),COLORMAGENTA;{RSI顶背离}
var31:=hhvbars(zig(3, 19)>ref(zig(3,19),1) and ref(zig(3,19), 1)<ref(zig(3,19), 2),0);
转折时间:var31+1,pointdot,colorff00ff,LINETHICK0;
时间窗:=0,colorwhite;
stickline(var31=2,l*0.95,l*0.98,8,0),color0000ff;
drawtext(var31=2,l*0.95,'3天'),coloryellow;
stickline(var31=4,h*1.05,h*1.02,8,0),color9966ff;
drawtext(var31=4,h*1.06,'5天'),coloryellow;
stickline(var31=7,l*0.95,l*0.98,8,0),color00ffff;
drawtext(var31=7,l*0.95,'8天'),coloryellow;
stickline(var31=12,h*1.05,h*1.02,8,0),colorff33ff;
drawtext(var31=12,h*1.06,'13天'),coloryellow;
stickline(var31=20,l*0.95,l*0.98,8,0),color0066ff;
drawtext(var31=20,l*0.95,'21天'),coloryellow;
stickline(var31=33,h*1.05,h*1.02,8,0),colorffff00;
drawtext(var31=33,h*1.06,'34天'),coloryellow;
stickline(var31=54,l*0.95,l*0.98,8,0),color006600;
drawtext(var31=54,l*0.95,'55天'),coloryellow;
stickline(var31=88,h*1.05,h*1.02,8,0),color00ff00;
drawtext(var31=88,h*1.06,'89天'),coloryellow;
stickline(var31=143,l*0.95,l*0.98,8,0),colorccffff;
drawtext(var31=143,l*0.95,'144天'),coloryellow;
stickline(var31=232 ,h*1.05,h*1.02,8,0),colorff0033;
drawtext(var31=232,h*1.06,'233天'),coloryellow;
stickline(var31=376,l*0.95,l*0.98,8,0),colorff9966;
drawtext(var31=376,l*0.95,'377天'),coloryellow;
ll:=COST(0);
hh:=COST(100);
aa1:=(hh-ll)/100;//把区间分成100份
tm1:=WINNER(ll[DATACOUNT]+aa1[DATACOUNT]);
tm:=tm1[DATACOUNT];
dyjw[1]:=ll[DATACOUNT]+aa1[DATACOUNT];
for k=2 to 100 do begin
dyjw[k]:=(ll[DATACOUNT]+k*aa1[DATACOUNT]);
dyhlp:=WINNER(dyjw[k]);
hlp:=dyhlp-tm1;
tm1:=dyhlp;
IF hlp[DATACOUNT]>tm then begin
tm:=hlp[DATACOUNT];
jg:=dyjw[k];
end;
end;
筹码密集峰价位:jg-aa1[DATACOUNT]/2,LINETHICK4,Coloryellow;
jg-aa1[DATACOUNT]/2,LINETHICK1,Colorred;
Aa1:=SUMBARS(VOL,CAPITAL);{www.88gs.com}
换手%成本:IF(CAPITAL>0,SUM(AMOUNT,Aa1)/SUM(VOL,Aa1)/100,EMA(CLOSE,120)),LINETHICK4,Colorgreen;{100%换手平均成本}
IF(CAPITAL>0,SUM(AMOUNT,Aa1)/SUM(VOL,Aa1)/100,EMA(CLOSE,120)),LINETHICK1,Colorgred;