当前位置:→ 公式网 > 飞狐公式 > 正文 ℃ 公式解密、改选股等业务 联系点击查看详情...
以下是飞狐反转魔力2主图公式(无源码的请下载附件导入)
飞狐反转魔力2主图公式
通过交点来判断变盘时间,参数见三张小图
主图最高:=SYSPARAM(4);
主图最低:=SYSPARAM(5);
个股量能:=VOL/MA(REF(VOL,1),5);
大盘量能:=INDEXV/MA(REF(INDEXV,1),5);
相对比较:=个股量能/大盘量能;
NN:=显示个数+1;
QK_0:=IF(DATACOUNT>天,DATACOUNT-天,1);
QK_1:=DATACOUNT-BARPOS+1<天;
QK_2:=HIGH*QK_1;
QK_3:=LOW*QK_1;
FOR I=DATACOUNT-1 DOWNTO QK_0 DO BEGIN
IF QK_2[I]<QK_2[I+1] THEN
QK_2[I]:=QK_2[I+1];
IF QK_3[I]>QK_3[I+1] THEN
QK_3[I]:=QK_3[I+1];
END;
QK_4:=IF(LOW>REF(HIGH,1),2,IF(HIGH<REF(LOW,1),1,0));
QK_5:=IF(QK_4=2,LOW,IF(QK_4=1,REF(LOW,1),0));
QK_6:=IF(QK_4=2,REF(HIGH,1),IF(QK_4=1,HIGH,0));
QK_7:=QK_4=2 AND QK_3<=QK_5 AND QK_3>=QK_6 OR QK_4=1 AND QK_2<QK_5 AND QK_2>=QK_6;
QK_8:=COUNT(QK_7,IF(BARPOS>天,天+1,0));
QK_9:=QK_8[DATACOUNT]-QK_8+1;
QK_10:=(QK_9<NN)*(BARSLAST(QK_7*BARPOS=BARPOS))+1;
QK_11:=LBOUND(QK_10);
QK_12:=IF(REF(QK_4,QK_10-1)=2,REF(QK_3,QK_10-1),IF(REF(QK_4,QK_10-1)=1,REF(QK_2,QK_10-1),0));
QK_13:=IF(REF(QK_4,QK_10-1)=2,REF(QK_6,QK_10-1),IF(REF(QK_4,QK_10-1)=1,REF(QK_5,QK_10-1),0));
QK_14:=MAX(QK_12,QK_13);
QK_15:=MIN(QK_12,QK_13);
A1:=SYSPARAM(1);
IF A1<QK_11 THEN
EXIT;
STICKLINE(QK_1 AND QK_10 AND QK_9<NN AND REF(QK_4,QK_10-1)=1,QK_12,QK_13,15,0),color808080;
STICKLINE(QK_1 AND QK_10 AND QK_9<NN AND REF(QK_4,QK_10-1)=2,QK_12,QK_13,15,0),colorAA9900;
DRAWTEXT(BARPOS=A1 AND QK_9<NN,QK_14,'倒数缺口:'+NUMTOSTR(QK_9[A1],0)+' \n'+NUMTOSTR(QK_15[A1],2)+'-'+NUMTOSTR(QK_14[A1],2)),ALIGN0,PXUP20,colorDDDDCC;
{MA1:MA(CLOSE,MAN1),LINETHICK2,colorFF;
MA2:MA(CLOSE,MAN2),LINETHICK2,color9000;
MA3:MA(CLOSE,MAN3),LINETHICK2,colorAAAA00;
MA4:MA(CLOSE,MAN4),LINETHICK2,color900090;}
KLINE(OPEN,HIGH,LOW,CLOSE,0);
KT1:=TROUGHBARS(2,时间精度,1);
FT1:=PEAKBARS(1,时间精度,1);
最近周期:=时间范围;
起点:=DATACOUNT-最近周期;
FZ1:=HIGH>=REF(HIGH,1) AND HIGH>=REFX(HIGH,1);
KZ1:=LOW<=REF(LOW,1) AND LOW<=REFX(LOW,1);
KK1:=KT1=0 AND LOW=LLV(LOW,转折强度);
FF1:=FT1=0 AND HIGH=HHV(HIGH,转折强度);
XQG:=IF(FF1,SUMBARS(FF1,2)-1,SUMBARS(FF1,1)-1);
XLG:=IF(KK1,SUMBARS(KK1,2)-1,SUMBARS(KK1,1)-1);
ZQG:=IF(FZ1,SUMBARS(FZ1,2)-1,SUMBARS(FZ1,1)-1);
ZLG:=IF(KZ1,SUMBARS(KZ1,2)-1,SUMBARS(KZ1,1)-1);
IF 升降开关>0 AND 升降开关<4 THEN BEGIN
XBY:=(LOW-REF(LOW,XLG))/XLG;
XBU:=INTPART((REF(HIGH,BARSLAST(IF(XQG>XLG,FZ1,FF1)))-LOW)/XBY+0.99);
XBU1:=INTPART((REF(HIGH,SUMBARS(IF(XQG>XLG,FZ1,FF1),2)-1)-LOW)/XBY+0.99);
DRAWSL(BARSLAST(IF(XQG>XLG,FZ1,FF1))<XLG AND XBU>0 AND LOW<REF(HIGH,IF(XQG>XLG,ZQG,XQG)) AND LOW>REF(LOW,XLG) AND KK1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,LOW,XBY,XBU,0),LINEDOT,colorFFFF;
DRAWSL(BARSLAST(IF(XQG>XLG,FZ1,FF1))<XLG AND XLG>0 AND LOW<REF(HIGH,IF(XQG>XLG,ZQG,XQG)) AND LOW>REF(LOW,XLG) AND KK1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,LOW,XBY,XLG,1),LINEDOT,colorFFFF;
DRAWSL(BARSLAST(IF(XQG>XLG,FZ1,FF1))<XLG AND BARSLAST(IF(XQG>XLG,FZ1,FF1))>0 AND LOW<REF(HIGH,IF(XQG>XLG,ZQG,XQG)) AND LOW>REF(LOW,XLG) AND KK1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(HIGH,BARSLAST(IF(XQG>XLG,FZ1,FF1))),0,BARSLAST(IF(XQG>XLG,FZ1,FF1)),1),LINEDOT,colorFFFF;
DRAWSL(BARSLAST(IF(XQG>XLG,FZ1,FF1))<XLG AND LOW<REF(HIGH,IF(XQG>XLG,ZQG,XQG)) AND LOW>REF(LOW,XLG) AND KK1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(HIGH,BARSLAST(IF(XQG>XLG,FZ1,FF1))),0,XBU,0),LINEDOT,colorFFFF;
XCY:=(LOW-REF(HIGH,XQG))/XQG;
XCU:=INTPART((ABS(REF(LOW,IF(XLG>XQG,ZLG,XLG))-LOW))/ABS(XCY)+0.99);
DRAWSL(XCU<>0 AND LOW<REF(HIGH,XQG) AND LOW>REF(HIGH,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,LOW,XCY,XCU,0),colorA0;
DRAWSL(XQG<>0 AND LOW<REF(HIGH,XQG) AND LOW>REF(HIGH,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,LOW,XCY,XQG,1),colorA0;
DRAWSL(IF(XLG>XQG,ZLG,XLG)<>0 AND LOW<REF(HIGH,XQG) AND LOW>REF(HIGH,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(LOW,IF(XLG>XQG,ZLG,XLG)),0,IF(XLG>XQG,ZLG,XLG),1),colorA0;
DRAWSL(XCU<>0 AND LOW<REF(HIGH,XQG) AND LOW>REF(HIGH,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(LOW,IF(XLG>XQG,ZLG,XLG)),0,XCU,0),colorA0;
XDY:=(HIGH-REF(HIGH,XQG))/XQG;
XDU:=INTPART((ABS(REF(LOW,BARSLAST(IF(XLG>XQG,KZ1,KK1)))-HIGH))/ABS(XDY)+0.99);
DRAWSL(XDU<>0 AND HIGH<REF(HIGH,XQG) AND HIGH<REFX(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,HIGH,XDY,XDU,0),colorA0;
DRAWSL(XQG<>0 AND HIGH<REF(HIGH,XQG) AND HIGH<REFX(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,HIGH,XDY,XQG,1),colorA0;
DRAWSL(IF(XLG>XQG,ZLG,XLG)<>0 AND HIGH<REF(HIGH,XQG) AND HIGH<REFX(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点 AND BARSLAST(KK1)<>0,REF(LOW,IF(XLG>XQG,ZLG,XLG)),0,IF(XLG>XQG,ZLG,XLG),1),colorA0;
DRAWSL(XDU<>0 AND HIGH<REF(HIGH,XQG) AND HIGH<REFX(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点 AND BARSLAST(KK1)<>0,REF(LOW,IF(XLG>XQG,ZLG,XLG)),0,XDU,0),colorA0;
END;
IF 升降开关<>1 AND 升降开关<4 AND 升降开关>=-1 THEN BEGIN
XCY1:=(HIGH-REF(HIGH,XQG))/XQG;
XCU1:=INTPART((ABS(HIGH-REF(LOW,BARSLAST(IF(XLG>XQG,KZ1,KK1)))))/ABS(XCY1)+0.99);
XCU2:=INTPART((ABS(HIGH-REF(LOW,SUMBARS(IF(XLG>XQG,KZ1,KK1),2)-1)))/ABS(XCY1)+0.99);
DRAWSL(BARSLAST(IF(XLG>XQG,KZ1,KK1))<XQG AND XCU1>0 AND HIGH>REF(LOW,IF(XLG>XQG,ZLG,XLG)) AND HIGH<REF(HIGH,XQG) AND FF1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,HIGH,XCY1,XCU1,0),LINEDOT,colorFF00;
DRAWSL(BARSLAST(IF(XLG>XQG,KZ1,KK1))<XQG AND XQG>0 AND HIGH>REF(LOW,IF(XLG>XQG,ZLG,XLG)) AND HIGH<REF(HIGH,XQG) AND FF1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,HIGH,XCY1,XQG,1),LINEDOT,colorFF00;
DRAWSL(BARSLAST(IF(XLG>XQG,KZ1,KK1))<XQG AND BARSLAST(IF(XLG>XQG,KZ1,KK1))>0 AND HIGH>REF(LOW,IF(XLG>XQG,ZLG,XLG)) AND HIGH<REF(HIGH,XQG) AND FF1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(LOW,BARSLAST(IF(XLG>XQG,KZ1,KK1))),0,BARSLAST(IF(XLG>XQG,KZ1,KK1)),1),LINEDOT,colorFF00;
DRAWSL(BARSLAST(IF(XLG>XQG,KZ1,KK1))<XQG AND HIGH>REF(LOW,IF(XLG>XQG,ZLG,XLG)) AND HIGH<REF(HIGH,XQG) AND FF1 AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(LOW,BARSLAST(IF(XLG>XQG,KZ1,KK1))),0,XCU1,0),LINEDOT,colorFF00;
XEY:=(LOW-REF(LOW,XLG))/XLG;
XEU:=INTPART((ABS(REF(HIGH,BARSLAST(IF(XQG>XLG,FZ1,FF1)))-LOW))/ABS(XEY)+0.99);
TJDQ:=XEU>0 AND LOW>REF(LOW,XLG) AND LOW>REFX(HIGH,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点;
DRAWSL(TJDQ,LOW,XEY,XEU,0),colorA0;
DRAWSL(TJDQ AND XLG<>0,LOW,XEY,XLG,1),LINEDOT,colorFFFFFF;
DRAWSL(TJDQ AND IF(XQG>XLG,ZQG,XQG)<>0,REF(HIGH,IF(XQG>XLG,ZQG,XQG)),0,IF(XQG>XLG,ZQG,XQG),1),colorA0;
DRAWSL(TJDQ,REF(HIGH,IF(XQG>XLG,ZQG,XQG)),0,XEU,0),colorA0;
XFY:=(HIGH-REF(LOW,XLG))/XLG;
XFU:=INTPART((ABS(REF(HIGH,IF(XQG>XLG,ZQG,XQG))-HIGH))/ABS(XFY)+0.99);
DRAWSL(XFU>0 AND HIGH>REF(LOW,XLG) AND HIGH<REF(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,HIGH,XFY,XFU,0),colorA0;
DRAWSL(XLG>0 AND HIGH>REF(LOW,XLG) AND HIGH<REF(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,HIGH,XFY,XLG,1),colorA0;
DRAWSL(IF(XQG>XLG,ZQG,XQG)>0 AND HIGH>REF(LOW,XLG) AND HIGH<REF(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(HIGH,IF(XQG>XLG,ZQG,XQG)),0,IF(XQG>XLG,ZQG,XQG),1),colorA0;
DRAWSL(XFU>0 AND HIGH>REF(LOW,XLG) AND HIGH<REF(LOW,1) AND BARPOS>=起点 AND REF(BARPOS,MAX(XLG,XQG))>=起点,REF(HIGH,IF(XQG>XLG,ZQG,XQG)),0,XFU,0),colorA0;
END;
DRAWTEXTEX(CLOSE,0,5,5,'今日涨停:'+NUMTOSTR(REF(CLOSE,1)*1.1,2)),colorA0A0A0;
DRAWTEXTEX(CLOSE,0,5,20,'今日跌停:'+NUMTOSTR(REF(CLOSE,1)*0.9,2)),colorA0A0A0;
DRAWTEXTEX(相对比较>1,0,5,35,'量能强弱:'+NUMTOSTR(相对比较,2)),colorA0000F0;
DRAWTEXTEX(相对比较<=1,0,5,35,'量能强弱:'+NUMTOSTR(相对比较,2)),colorA009000;
DRAWTEXTEX(1,0,5,50,'测量周期:'+NUMTOSTR(时间范围,2)),colorA0A0A0;
R:=VOL/((HIGH-LOW)*2-(ABS(OPEN-CLOSE)));
买:=IF(OPEN=CLOSE AND (CLOSE-REF(CLOSE,1))/REF(CLOSE,1)*100>9.8,VOL,R*(CLOSE-LOW));
资比:=买/VOL*100;
主力流入:=AMOUNT*资比/10000000000;
主力流出:=AMOUNT/100000000-主力流入;
资金差额:=主力流入-主力流出;
资金比率:=资比;
DRAWTEXTEX(DATATYPE>-1,1,850,850,'主力流入:'+NUMTOSTR(主力流入,2)+' 亿'),colorAA;
DRAWTEXTEX(DATATYPE>-1,1,850,900,'主力流出:'+NUMTOSTR(主力流出,2)+' 亿'),colorAA00;
DRAWTEXTEX(DATATYPE>-1,1,850,950,'资金差额:'+NUMTOSTR(资金差额,2)+' 亿'),color808080;
DRAWTEXTEX(DATATYPE>-1,1,850,1000,'资金比率:'+NUMTOSTR(资金比率,2)),colorAAAA;