通达信空中加油主图优化公式
每一轮反弹,都有强势股空中加油后再大幅上涨,本论坛有几位高手都分享了空中加油主图源码,但显示图上过于向上缩进,本人尊重原分享者的前提下,略加优化,使显示在图上更加清楚。
{本论坛空中加油(主图)源码}
MA5:MA(CLOSE,5);
MA10:MA(CLOSE,10);
MA20:MA(CLOSE,20);
MA30:MA(CLOSE,30);
MA250:MA(CLOSE,250),COLORRED;
N1:=BARSLAST(CROSS(MA5,MA10));
N2:=BARSLAST(CROSS(MA10,MA5));
多:=IF(N1<N2,N1+1,0);
空:=IF(N2<N1,N2+1,0);
QSXS:=MA5>MA20 AND MA10>MA20 AND MA20>REF(MA20,1) AND MA30>REF(MA30,1);
启动:=多*QSXS,COLORRED,LINETHICK0;
跑道:=空*QSXS,COLORFFFF00,LINETHICK0;
HKFJ:=HHV(多,5)>=2 AND QSXS AND MA5>REF(MA5,1) AND MA5>MA10;
航空飞机:=HKFJ*多,COLORFF00FF,LINETHICK2;
HKSJ:=BARSLAST(航空飞机>0 AND NOT(REF(航空飞机,1)))+1;
高度:=(C/REF(C,HKSJ)-1)*100,COLOR00FFFF;
空中加油:启动>0 AND 航空飞机=0,COLOR00FF00,POINTDOT,LINETHICK0;
N3:=BARSLAST(空中加油)+1;
K5:=ATAN((MA5/REF(MA5,1)-1)*100)*180/3.14159;
JXGD1:=K5>REF(K5,1) AND REF(K5,1)<REF(K5,2);
JXGD2:=MA5>REF(MA5,1) AND REF(MA5,1)<REF(MA5,2);
加速远航:FILTER((JXGD1 OR JXGD2) AND C>MA5 AND HKFJ,3),COLOR00FFFF,POINTDOT,LINETHICK0;
N4:=BARSLAST(加速远航);
{以下设置主图显示方式}
STICKLINE(空中加油,(O+C)/2-0.01,(O+C)/2+0.01,4,0),COLOR00FF00;
STICKLINE(空中加油,L,H,1,1),COLOR00FF00;
STICKLINE(加速远航,(O+C)/2-0.01,(O+C)/2+0.01,4,0),COLOR00FFFF;
STICKLINE(加速远航,L,H,1,1),COLOR00FFFF;
STICKLINE(N4>0 AND N4<=5,REF(O,N4+1),REF(O,N4+1),4,1),COLORFFFFFF;
DRAWTEXT(加速远航,L,'加▲速'),COLOR00FFFF;
DRAWTEXT(航空飞机,MA30,'○'),COLORFFFFFF;
DRAWTEXT(空中加油,MA30,'□'),COLOR00FF00;
{本人优化后空中加油(主图)源码}
MA5:MA(CLOSE,5),LINETHICK1;
MA10:MA(CLOSE,10),LINETHICK1;
MA20:MA(CLOSE,20),LINETHICK2;
MA30:MA(CLOSE,30),LINETHICK1;
MA250:MA(CLOSE,250),COLORFF3399,LINETHICK3;
N1:=BARSLAST(CROSS(MA5,MA10));
N2:=BARSLAST(CROSS(MA10,MA5));
多:=IF(N1<N2,N1+1,0);
空:=IF(N2<N1,N2+1,0);
QSXS:=MA5>MA20 AND MA10>MA20 AND MA20>REF(MA20,1)
AND MA30>REF(MA30,1);
启动:=多*QSXS,COLORRED,LINETHICK0;
跑道:=空*QSXS,COLORFFFF00,LINETHICK0;
HKFJ:=HHV(多,5)>=2 AND QSXS AND MA5>REF(MA5,1) AND MA5>MA10;
航空飞机:=HKFJ*多,COLORFF00FF,LINETHICK2;
HKSJ:=BARSLAST(航空飞机>0 AND NOT(REF(航空飞机,1)))+1;
高度:=(C/REF(C,HKSJ)-1)*100,COLOR00FFFF;
空中加油:=启动>0 AND 航空飞机=0,COLOR00FF00,POINTDOT,LINETHICK0;
N3:=BARSLAST(空中加油)+1;
K5:=ATAN((MA5/REF(MA5,1)-1)*100)*180/3.14159;
JXGD1:=K5>REF(K5,1) AND REF(K5,1)<REF(K5,2);
JXGD2:=MA5>REF(MA5,1) AND REF(MA5,1)<REF(MA5,2);
加速远航:=FILTER((JXGD1 OR JXGD2)
AND C>MA5 AND HKFJ,3),COLOR00FFFF,POINTDOT,LINETHICK0;
N4:=BARSLAST(加速远航);
{以下设置主图显示方式}
STICKLINE(空中加油,(O+C)/2-0.01,(O+C)/2+0.01,4,0),COLOR00FF00;
STICKLINE(空中加油,L,H,1,1),COLOR00FF00;
STICKLINE(加速远航,(O+C)/2-0.01,(O+C)/2+0.01,4,0),COLOR00FFFF;
STICKLINE(加速远航,L,H,1,1),COLOR00FFFF;
STICKLINE(N4>0 AND N4<=5,REF(O,N4+1),REF(O,N4+1),4,1),COLORFFFFFF;
DRAWTEXT(加速远航,L,'加▲速'),COLOR00FFFF;
DRAWTEXT(航空飞机,MA30,'○'),COLORFFFFFF;
DRAWTEXT(空中加油,MA30,'★加油'),COLOR00FF00;