选股公式成功率95操盘手 股票选股公式编写教程 明日提示 副图指
操盘手源码全集
{明日提示}
均线21:MA(CLOSE,21);
高:=MA(REF(HIGH,1)/REF(CLOSE,2),27)*REF(CLOSE,1),LINETHICK2;
低:=MA(REF(LOW,1)/REF(CLOSE,2),27)*REF(CLOSE,1),LINETHICK2;
预测高点:高,COLORRED;
预测低点:低,COLORGREEN;
{实战MACD(飞狐)}
input:LONG(26,20,100),SHORT(12,5,40),M(9,2,60);
MK:="MACD.DIFF#week";
MD:="MACD.DEA#week";
FILLRGN(MK > MD,MK,MD),colorff;
FILLRGN(MK< MD,MD,MK),colorFF0000;
DIFF:=(EMA(CLOSE,SHORT) - EMA(CLOSE,LONG));
DEA:=EMA(DIFF,M);
MACD2:=(2 * (DIFF - DEA));
VERTLINE(((CLOSE < 0) AND CROSS(DIFF,0))),color80;
VERTLINE(((CLOSE < 0) AND CROSS(MACD2,0))),color80;
VERTLINE(((CLOSE < 0) AND CROSS(0,DIFF))),color808080;
VERTLINE(((CLOSE < 0) AND CROSS(0,MACD2))),color808080;
DU0:=CROSS(DIFF,0);
UD0:=CROSS(0,DIFF);
TDU0:=BARSLAST(DU0);
TUD0:=BARSLAST(UD0);
DU3:=REF(DU0,1);
UD3:=REF(UD0,1);
TDU3:=BARSLAST(DU3);
TUD3:=BARSLAST(UD3);
UDGLINE:=IF((TDU3 < TUD3),REF(HHV(HIGH,2),TDU3),REF(LLV(LOW,2),TUD3));
JDU0:=(((REF(CLOSE,1) <= REF(UDGLINE,1)) AND (CLOSE > UDGLINE)) AND (TDU0 < TUD0));
JUD0:=(((REF(CLOSE,1) >= REF(UDGLINE,1)) AND (CLOSE < UDGLINE)) AND (TUD0 < TDU0));
JDU1:=(JDU0 AND (COUNT(JDU0,TDU0) = 1));
JUD1:=(JUD0 AND (COUNT(JUD0,TUD0) = 1));
JDU2:=(JDU1 AND (REF(BARSLAST(JUD1),1) < REF(BARSLAST(JDU1),1)));
JUD2:=(JUD1 AND (REF(BARSLAST(JUD1),1) > REF(BARSLAST(JDU1),1)));
JDU3:=(JDU1 AND (REF(BARSLAST(JUD1),1) > REF(BARSLAST(JDU1),1)));
JUD3:=(JUD1 AND (REF(BARSLAST(JUD1),1) < REF(BARSLAST(JDU1),1)));
BSLINE:=IF((BARSLAST(JDU2) < BARSLAST(JUD2)),IF(REF(CROSS(0,MACD2),1),LLV(LOW,2),REF(LLV(LOW,2),BARSLAST(REF(CROSS(0,MACD2),1)))),IF(REF(CROSS(MACD2,0),1),HHV(HIGH,2),REF(HHV(HIGH,2),BARSLAST(REF(CROSS(MACD2,0),1)))));
DRAWICON((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))),0,10),ALIGN4;
DRAWICON((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))),0,11),ALIGN5;
STICKLINE((MACD2 >= 0),0,MACD2,6,1),colorFF;
STICKLINE(((MACD2 >= 0) AND (MACD2 < REF(MACD2,1))),0,MACD2,6,0),colorFF;
STICKLINE((MACD2 < 0),0,MACD2,6,0),colorFFFF00;
STICKLINE(((MACD2 < 0) AND (MACD2 > REF(MACD2,1))),0,MACD2,6,1),colorFFFF00;
DIF:DIFF,LINETHICK2,colorFFFF;
MACD:DEA,colorFF00;
DEF:MACD2,LINETHICK0,colorFFFF00;
STICKLINE((CLOSE > 0),0,0,10,0),color808080;
DEFUT:=BARSLAST(CROSS(MACD2,0));
DEFDT:=BARSLAST(CROSS(0,MACD2));
DEFUL:=IF((MACD2 >= 0),HHV(MACD2,(DEFUT + 1)),REF(HHV(MACD2,(DEFUT + 1)),(DEFDT + 1)));
DEFDL:=IF((MACD2 < 0),LLV(MACD2,(DEFDT + 1)),REF(LLV(MACD2,(DEFDT + 1)),(DEFUT + 1)));
DEFU2L:=REF(DEFUL,(DEFUT + 1));
DEFD2L:=REF(DEFDL,(DEFDT + 1));
DRAWICON(((((LLV(MACD2,4) > 0) AND (MACD2 < REF(MACD2,1))) AND (REF(MACD2,1) > REF(MACD2,2))) AND (REF(MACD2,2) > REF(MACD2,3))),MACD2,5),ALIGN0;
DRAWICON(((((HHV(MACD2,4) < 0) AND (MACD2 > REF(MACD2,1))) AND (REF(MACD2,1) < REF(MACD2,2))) AND (REF(MACD2,2) < REF(MACD2,3))),MACD2,4);
DRAWICON(((((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))) AND (MACD2 >= 0)) AND (REF(MACD2,1) < REF(DEFU2L,1))) AND (MACD2 > DEFU2L)),MACD2,12),ALIGN0;
DRAWICON(((((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))) AND (MACD2 < 0)) AND (REF(MACD2,1) > REF(DEFD2L,1))) AND (MACD2 < DEFD2L)),MACD2,12);
EXPLAIN(JDU2,'注意长线趋势空转多');
EXPLAIN(JUD2,'注意长线趋势多转空');
EXPLAIN((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))),'长线为多头趋势');
EXPLAIN((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))),'长线为空头趋势');
EXPLAINEX((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))),'MACD多头防守价',BSLINE,2,1);
EXPLAINEX((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))),'MACD空头防守价',BSLINE,2,1);
EXPLAIN(((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))) AND (CLOSE < BSLINE)),'防守价跌破:多头小心');
EXPLAIN(((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))) AND (CLOSE > BSLINE)),'防守价突破:空头小心');
EXPLAIN(((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))) AND CROSS(MACD2,0)),'空头注意今明两日高点压力,找日落K线放空,用线控盘');
EXPLAIN(((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))) AND CROSS(0,MACD2)),'多头注意今明两日低点支撑,找日出K线做多,用线控盘');
EXPLAIN(((((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))) AND (MACD2 >= 0)) AND (REF(MACD2,1) < REF(DEFU2L,1))) AND (MACD2 > DEFU2L)),'DEF柱状特殊研判\n空头注意今明两日高点压力');
EXPLAIN(((((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))) AND (MACD2 < 0)) AND (REF(MACD2,1) > REF(DEFD2L,1))) AND (MACD2 < DEFD2L)),'DEF柱状特殊研判\n多头注意今明两日低点支撑');
EXPLAINEX((REF((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))),1) AND CROSS(REF(MACD2,1),0)),'空头注意压力',HHV(HIGH,2),2,1);
EXPLAIN((REF((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))),1) AND CROSS(REF(MACD2,1),0)),'找日落K线放空,用线控盘');
EXPLAINEX((REF((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))),1) AND CROSS(0,REF(MACD2,1))),'多头注意支撑',LLV(LOW,2),2,1);
EXPLAIN((REF((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))),1) AND CROSS(0,REF(MACD2,1))),'找日出K线进场,用线控盘');
EXPLAIN(((((LLV(MACD2,4) > 0) AND (MACD2 < REF(MACD2,1))) AND (REF(MACD2,1) > REF(MACD2,2))) AND (REF(MACD2,2) > REF(MACD2,3))),'请注意DEF柱状缩头');
EXPLAIN(((((HHV(MACD2,4) < 0) AND (MACD2 > REF(MACD2,1))) AND (REF(MACD2,1) < REF(MACD2,2))) AND (REF(MACD2,2) < REF(MACD2,3))),'请注意DEF柱状缩脚');
{按部就班}
N(1,100,5)
现价:C;
MC=MCOST(4, 19*N, 15*N, 6*N, 1*N);
顶部: MC[1] ,colorffff33;
卖出: MC[2] ,colorgreen;
买入: MC[3] ,colorred;
底部: MC[4] ,coloryellow;
{波段无敌}
坐标线:-50;-30;0;30;50
P1=0;
P2= IF (CLOSE>MA(CLOSE,5),P1+10,P1-10);
P3= IF (CLOSE>MA(CLOSE,10),P2+10,P2-10);
P4= IF (CLOSE>MA(CLOSE,10),P3+10,P3-10);
P5= IF (MA(CLOSE,5)>MA(CLOSE,10),P4+10,P4-10);
P6= IF (MA(CLOSE,10)>MA(CLOSE,20),P5+10,P5-10);
BD6;
STICKLINE(BD>=-50,-50,BD,5,0)COLORGREEN;
STICKLINE(BD>=-30,-30,BD,5,0)COLORCYAN;
STICKLINE(BD>=0,0,BD,5,0)COLORYELLOW;
STICKLINE(BD<=50&&BD>=30,30,BD,5,0)COLORRED;
{冰火两重天}
P(0,100,16);
能量=SQRT(VOL)*(((C-(H+L)/2))/((H+L)/2));
平滑能量=EMA(能量,P);
能量惯性:EMA(平滑能量,P) ;
STICKLINE(能量惯性>=0,(能量惯性-能量惯性*0.05),(能量惯性-能量惯性*0.15),5,0) COLOR0000CC;
STICKLINE(能量惯性>=0,(能量惯性-能量惯性*0.2),(能量惯性-能量惯性*0.35),5,0) COLOR0066ff;
STICKLINE(能量惯性>=0,(能量惯性-能量惯性*0.4),(能量惯性-能量惯性*0.55),5,0) COLOR0099ff;
STICKLINE(能量惯性>=0,(能量惯性-能量惯性*0.6),(能量惯性-能量惯性*0.75),5,0) COLOR00CCff;
STICKLINE(能量惯性>=0,(能量惯性-能量惯性*0.8),(能量惯性-能量惯性*0.95),5,0) COLOR00ffff;
STICKLINE(能量惯性<0,(能量惯性-能量惯性*0.05),(能量惯性-能量惯性*0.15),5,0) COLORff3300;
STICKLINE(能量惯性<0,(能量惯性-能量惯性*0.2),(能量惯性-能量惯性*0.35),5,0) COLORFF6600;
STICKLINE(能量惯性<0,(能量惯性-能量惯性*0.4),(能量惯性-能量惯性*0.55),5,0) COLORFF9900;
STICKLINE(能量惯性<0,(能量惯性-能量惯性*0.6),(能量惯性-能量惯性*0.75),5,0) COLORffcc00;
STICKLINE(能量惯性<0,(能量惯性-能量惯性*0.8),(能量惯性-能量惯性*0.95),5,0) COLORffff00;
{筹码分析}
HSL=EMA(VOL/CAPITAL,3);
ZDL=HHV(HSL,240);
ZXL=LLV(HSL,240);
XS=MA(C,33);
锁定筹码:EMA((HSL-ZXL)/ZXL*XS,13);
浮动筹码:EMA((ZDL-HSL)/HSL*XS,13);
力量对比:锁定筹码-浮动筹码 #COLORSTICK
{多空博弈}
Var1=(HHV(HIGH,21)-C)/(HHV(HIGH,21)-LLV(LOW,21))*100-10;
Var2=(C-LLV(LOW,21))/(HHV(HIGH,21)-LLV(LOW,21))*100;
Var3=SMA(Var2,13,8);
高位:90;
低位:0;
多方: SMA(Var3,13,8),COLORRED;
空方: SMA(Var1,21,8),COLORGREEN;
中轴:45
{龙腾四海}
N (0, 100, 8);
坐标线:0;20;50;80;100
龙腾四海:100-100*(HHV(HIGH,5*N)-CLOSE)/(HHV(HIGH,5*N)-LLV(LOW,5*N));
海面:20,COLORGREEN;
海天分界线:50,COLORYELLOW;
天际:80,COLORRED;
{买卖频谱}
买线:EMA(C,3);
卖线:EMA(SLOPE(C,21)*20+C,55);
买卖差=买线-卖线;
STICKLINE(买卖差>=0,(买线-买卖差*0.05),(买线-买卖差*0.15),5,0) #COLOR00ffff;
STICKLINE(买卖差>=0,(买线-买卖差*0.2),(买线-买卖差*0.35),5,0) #COLOR00ccff;
STICKLINE(买卖差>=0,(买线-买卖差*0.4),(买线-买卖差*0.55),5,0) #COLOR0099ff;
STICKLINE(买卖差>=0,(买线-买卖差*0.6),(买线-买卖差*0.75),5,0) #COLOR0066ff;
STICKLINE(买卖差>=0,(买线-买卖差*0.8),(买线-买卖差*0.95),5,0) #COLOR0000cc;
STICKLINE(买卖差<0,(卖线+买卖差*0.05),(卖线+买卖差*0.15),5,0) #COLOR006600;
STICKLINE(买卖差<0,(卖线+买卖差*0.2),(卖线+买卖差*0.35),5,0) #COLOR009900;
STICKLINE(买卖差<0,(卖线+买卖差*0.4),(卖线+买卖差*0.55),5,0) #COLOR00cc00;
STICKLINE(买卖差<0,(卖线+买卖差*0.6),(卖线+买卖差*0.75),5,0) #COLOR00ff00;
STICKLINE(买卖差<0,(卖线+买卖差*0.8),(卖线+买卖差*0.95),5,0) #COLOR66ff00;
{主力进出}
MAV=(C*2+H+L)/4;
SK = EMA(MAV,13) - EMA(MAV,34);
SD = EMA(SK,5);
中轴:0;
空方主力 : (-2*(SK-SD))*3.8,COLORGREEN;
多方主力 : (2*(SK-SD))*3.8,COLORRED;
{主力拉升意愿}
坐标线:-10;50;70;110;
ww:100*(CLOSE-LLV(LOW,18))/(HHV(HIGH,18)-LLV(LOW,18));
ww2:100*(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36));
lsqu:70;
{主力能量}
坐标线:150;180;210;240;450
zlnl2=SUM(vol,30)/FINANCE(3)+150;
zlnl:if(zlnl2<240,zlnl2,ref(zlnl2,1)*2/3+zlnl2/3);
ftqy:30+150;
tzqy:60+150;
lsqy:90+150;
{主力试盘意愿}
aa=100*(HHV(HIGH,18)-CLOSE)/(HHV(HIGH,18)-LLV(LOW,18));
cpszlsp:if(aa>99,100,0);