//定义的基本参数和条件
MA5:MA(C,5);
MA10:MA(C,10);
MA20:MA(C,20);
高:=MAX(O,C);
低:=MIN(O,C);
波动:=(高-低)/低*100;
开:=(O-REF(C,1))/REF(C,1)*100;
振幅:=(H-L)/L*100;
涨幅:=(C-REF(C,1))/REF(C,1)*100;
十日平均波动:=MA(波动,10);
十日平均振幅:=MA(振幅,10);
五日平均振幅:=MA(振幅,5);
RSV=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K=SMA(RSV,3,1);
D=SMA(K,3,1);
J=3*K-2*D;
DIFF : =EMA(CLOSE,12) - EMA(CLOSE,26);
DEA : =EMA(DIFF,9);
MACD : =2*(DIFF-DEA);
攻击角度:=ATAN((MA5/REF(MA5,1)-1)*100)*180/3.1416;
角5:=攻击角度;
角10:=ATAN((MA10/REF(MA10,1)-1)*100)*180/3.1416;
角20:=ATAN((MA20/REF(MA20,1)-1)*100)*180/3.1416;
中 : = MA(CLOSE,20);
上: 中 + 2*STD(CLOSE,20);
下: 中 - 2*STD(CLOSE,20);
中上轨:上-(上-下)/6;
中下轨:下+(上-下)/6;
//确认趋势行情
三线上开花:=MA5>MA20 AND 角5>0 AND 角10>0 AND 角20>0 AND 上>REF(上,1);
三线下开花:=MA5<MA20 AND 角5<0 AND 角10<0 AND 角20<0 AND 下<REF(下,1);
趋势上涨:=IF(三线上开花,1,0);
趋势下跌:=IF(三线下开花,1,0);
震荡:=IF(趋势上涨=0 AND 趋势下跌=0,1,0);
//用不同颜色画不同行情的K线
STICKLINE(趋势上涨=1,H,L,0,0),colorred;
STICKLINE(趋势上涨=1 AND C>=O,C,O,10,1),colorred;
STICKLINE(趋势上涨=1 AND C<O,C,O,10,0),colorred;
STICKLINE(趋势下跌=1,H,L,0,0),RGB(0,100,255);
STICKLINE(趋势下跌=1 AND C>=O,C,O,10,1),RGB(0,100,255);
STICKLINE(趋势下跌=1 AND C<O,C,O,10,0),RGB(0,100,255);
STICKLINE(震荡=1,H,L,0,0),coloryellow;
STICKLINE(震荡=1 AND C>=O,C,O,10,1),coloryellow;
STICKLINE(震荡=1 AND C<O,C,O,10,0),coloryellow;
//界面中上方信息提示
DRAWNUMBER_FIX(ISLASTBAR,0.69,0.1,0,TOSTRING(角5,0)),colorcyan;
DRAWTEXT_FIX(ISLASTBAR,0.57,0.1,0,"最新上攻角度 -->"),colorred;
DRAWTEXT_FIX(C>0,0.57,0.05,0,'<使用说明> -->'),colorred;
DRAWTEXT_FIX(C>0,0.64,0.05,0,'红色上涨,蓝色下跌,黄色震荡'),colorcyan;
//震荡行情买卖点提示
跳空高开:=O>REF(C,1) AND (O-REF(C,1))/REF(C,1)*100>十日平均波动*0.5;
跳空低开:=O<REF(C,1) AND (REF(C,1)-O)/REF(C,1)*100>十日平均波动*0.5;
大阴:=(O-C)/C*100>十日平均波动*2.5 OR 涨幅<-6;
大阳:=(C-O)/O*100>十日平均波动*2.5 OR 涨幅>6;
B1:=L<中下轨 AND L<=MA5 AND 震荡 AND 大阴=0 AND 跳空低开=0;
S1:=H>中上轨 AND H>=MA5 AND 震荡 AND 大阳=0 AND 跳空高开=0;
//K线小头部或底部买卖提示
新高收阴:=C<REF(C,1) AND H>REF(H,1) AND 高<=上 AND 高>MA10;
新低收阳:=C>REF(C,1) AND L<REF(L,1) AND 低>=下 AND 低<MA10;
J顶:=J<REF(J,1) AND REF(J,1)>REF(J,2) AND 高<=上 AND 高>MA10;
J底:=J>REF(J,1) AND REF(J,1)<REF(J,2) AND 低>=下 AND 低<MA10;
抛0:=REF(新高收阴,1) OR REF(J顶,1);
吸0:=REF(新低收阳,1) OR REF(J底,1);
B3:=吸0 AND 跳空低开=0 AND L<MA5 AND 趋势下跌=0 AND REF(C,2)<=MA20;
S3:=抛0 AND 跳空高开=0 AND H>MA5 AND 趋势上涨=0 AND REF(C,2)>=MA20;
//买卖点汇总
买点:=B1+B3>0;
卖点:=S1+S3>0;
DRAWICON(买点,L,1);
DRAWICON(卖点,H,2);
//配合选股公示显示回踩价格
L1:=IF(开>=-2 AND 开<-1.5,O*(1-0.005),0);
L2:=IF(开>=-1.5 AND 开<0,O*(1-0.01),0);
L3:=IF(开>=0 AND 开<1.5,O*(1-0.02),0);
L4:=IF(开>=1.5 AND 开<3,O*(1-0.03),0);
L5:=IF(开>=3 AND 开<4.5,O*(1-0.04),0);
L6:=IF(开>=4.5 AND 开<6,O*(1-0.05),0);
L7:=IF(开>=6 AND 开<7.5,O*(1-0.06),0);
L8:=IF(开>=7.5 AND 开<9,O*(1-0.07),0);
L9:=IF(开>=9 AND 开<10.5,O*(1-0.075),0);
回踩价:=L1+L2+L3+L4+L5+L6+L7+L8+L9;
开花:=三线上开花 AND 角5>=45 AND 开>=0;
回踩进场价格:=IF(REF(开花,1) AND 开>=-1 AND 回踩价>中上轨,回踩价,0);
AA:=BARSLAST(回踩进场价格>0)+1;
浮动盈亏百分比:=(C-REF(回踩进场价格,BARSLAST(回踩进场价格>0)))/REF(回踩进场价格,BARSLAST(回踩进场价格>0))*100;
DRAWNUMBER_FIX(AA<=5 AND ISLASTBAR AND REF(回踩进场价格,BARSLAST(回踩进场价格>0))>0,0.69,0.15,0,TOSTRING(REF(回踩进场价格,BARSLAST(回踩进场价格>0)),2)),colorcyan;
DRAWTEXT_FIX(AA<=5 AND ISLASTBAR AND REF(回踩进场价格,BARSLAST(回踩进场价格>0))>0,0.57,0.15,0,"成本价 -->"),colorred;
DRAWNUMBER_FIX(AA<=5 AND ISLASTBAR AND REF(回踩进场价格,BARSLAST(回踩进场价格>0)),0.69,0.2,0,TOSTRING(C,2)),colorcyan;
DRAWTEXT_FIX(AA<=5 AND ISLASTBAR AND REF(回踩进场价格,BARSLAST(回踩进场价格>0)),0.57,0.2,0,"最新价 -->"),colorred;
DRAWNUMBER_FIX(AA<=5 AND ISLASTBAR,0.69,0.25,0,TOSTRING(浮动盈亏百分比,2)),colorcyan;
DRAWTEXT_FIX(AA<=5 AND ISLASTBAR,0.57,0.25,0,"当前浮动盈亏百分比 -->"),colorred;
STICKLINE(回踩进场价格>0,回踩进场价格,回踩进场价格*1.003,12,0);