飞狐MA_X主图公式
量子汤证券投资工作室版权所有:7,LINETHICK0,PRECISION1;
H1:=REF(HIGH,1);
H2:=REF(HIGH,2);
H3:=REF(HIGH,3);
HX1:=REFX(HIGH,1);
HX2:=REFX(HIGH,2);
HX3:=REFX(HIGH,3);
L1:=REF(LOW,1);
L2:=REF(LOW,2);
L3:=REF(LOW,3);
LX1:=REFX(LOW,1);
LX2:=REFX(LOW,2);
LX3:=REFX(LOW,3);
UFFX:=HIGH>=MAX(H1,MAX(H2,H3)) AND HIGH>MAX(HX1,MAX(HX2,HX3));
DFFX:=LOW<=MIN(L1,MIN(L2,L3)) AND LOW<MIN(LX1,MIN(LX2,LX3));
PEU:=BARSLAST(UFFX);
PED:=BARSLAST(DFFX);
TOP:=SYSPARAM(4);
BOT:=SYSPARAM(5);
TB:=BARSLAST(FILTERX(LOW=BOT,DATACOUNT));
TT:=BARSLAST(FILTERX(HIGH=TOP,DATACOUNT));
A:=IF(TB>=0,1,0);
ABOT1:=IF(STKTYPE=0 OR STKTYPE=7,FLOOR(BOT/10),IF(BOT>=100,FLOOR(BOT),IF(BOT<10,FLOOR(BOT*10),FLOOR(BOT*10))));
ATOP1:=IF(STKTYPE=0 OR STKTYPE=7,FLOOR(TOP/10),IF(TOP>=100,FLOOR(TOP),IF(TOP<10,FLOOR(TOP*10),FLOOR(TOP*10))));
ABL:=IF(STKTYPE=0 OR STKTYPE=7,FLOOR(LOW/10),IF(BOT>=100,FLOOR(LOW),IF(BOT<1,FLOOR(LOW*10),FLOOR(LOW*10))));
ATH:=IF(STKTYPE=0 OR STKTYPE=7,FLOOR(HIGH/10),IF(BOT>=100,FLOOR(HIGH),IF(BOT<1,FLOOR(HIGH*10),FLOOR(HIGH*10))));
ABC:=IF(STKTYPE=0 OR STKTYPE=7,FLOOR(CLOSE/10),IF(BOT>=100,FLOOR(CLOSE),IF(BOT<1,FLOOR(CLOSE*10),FLOOR(CLOSE*10))));
AGBOT:=IF(STKTYPE=0 OR STKTYPE=7,FLOOR(BOT/1),IF(BOT>=100,FLOOR(BOT),IF(BOT<10,FLOOR(BOT*10),FLOOR(BOT*10))));
AGTOP:=IF(STKTYPE=0 OR STKTYPE=7,FLOOR(TOP/1),IF(TOP>=100,FLOOR(TOP),IF(TOP<10,FLOOR(TOP*10),FLOOR(TOP*10))));
QH_B:=ROUND((SQRT(AGBOT)-0.22)/2);
ZERO_B:=POW(QH_B*2+1,2)-7*QH_B;
ANGLE_B:=(AGBOT-ZERO_B)*45/QH_B;
N:=IF(ANGLE_B<360 AND ANGLE_B>315,MOD(ANGLE_B,315),IF(ANGLE_B<315 AND ANGLE_B>270,MOD(ANGLE_B,270),IF(ANGLE_B<270 AND ANGLE_B>225,MOD(ANGLE_B,225),IF(ANGLE_B<225 AND ANGLE_B>180,MOD(ANGLE_B,180),IF(ANGLE_B<180 AND ANGLE_B>135,MOD(ANGLE_B,135),IF(ANGLE_B<135 AND ANGLE_B>90,MOD(ANGLE_B,90),IF(ANGLE_B<90 AND ANGLE_B>45,MOD(ANGLE_B,45),23)))))));
MA1:=MA(LOW,N*0.5);
MA2:=MA(LOW,N);
MA3:=MA(LOW,N*2);
MA4:=MA(LOW,N*4);
MA5:=MA(LOW,N*6);
MA6:=MA(LOW,N*8);
MA7:=MA(LOW,N*10);
N,LINETHICK0;
FILLRGN(MA3>MA4,MA4*1,MA3*1),color9FCE11;
FILLRGN(MA5>MA6,MA6*1,MA5*1),color9DDDEE;
FILLRGN(MA6>MA7,MA7*1,MA6*1),color9FCE66;
IF N>=10 THEN BEGIN
M1:MA1*1;
FILLRGN(MA1>MA2,MA2*1,MA1*1),color9FCECC;
END;
M2:MA2*1;
M3:MA3*1;
M4:MA4*1;
M5:MA5*1;
M6:MA6*1;
M7:MA7*1;
STICKLINE(CLOSE>OPEN,HIGH,LOW,0,1),color90;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,1),color90;
STICKLINE(CLOSE<=OPEN,HIGH,LOW,0,0),color408080;
STICKLINE(CLOSE<=OPEN,CLOSE,OPEN,6,0),color408000;
DRAWNUMBER(TB=N*0.5,MA1,N*0.5,0),color10000;
DRAWNUMBER(TB=N,MA2,N,0),color10000;
DRAWNUMBER(TB=N*2,MA3,N*2,0),color10000;
DRAWNUMBER(TB=N*4,MA4,N*4,0),color10000;
DRAWNUMBER(TB=N*6,MA5,N*6,0),color10000;
DRAWNUMBER(TB=N*8,MA4,N*8,0),color10000;
DRAWNUMBER(TB=N*10,MA5,N*10,0),color10000;
IF STKTYPE=0 OR STKTYPE=7 THEN BEGIN
DRAWNUMBER(UFFX AND HIGH<>SYSPARAM(4),HIGH,TB,0),ALIGN0,PXUP30,color808000;
DRAWNUMBER(UFFX AND HIGH=SYSPARAM(4),HIGH,TB,0),ALIGN2,PXUP30,color808000;
DRAWNUMBER(DFFX AND LOW<>SYSPARAM(5),LOW,TB,0),ALIGN0,PXDN5,color808000;
DRAWNUMBER(UFFX AND HIGH<>SYSPARAM(4),HIGH*A,ATH,0),ALIGN0,PXUP55,color80;
DRAWNUMBER(UFFX AND HIGH=SYSPARAM(4),HIGH*A,ATH,0),ALIGN2,PXUP55,color80;
DRAWNUMBER(DFFX AND LOW<>SYSPARAM(5),LOW*A,ABL,0),ALIGN0,PXDN25,color80;
END;
IF STKTYPE=1 AND DATATYPE<=8 THEN BEGIN
DRAWNUMBER(UFFX AND HIGH<>SYSPARAM(4),HIGH,TB,0),ALIGN0,PXUP30,color808000;
DRAWNUMBER(UFFX AND HIGH=SYSPARAM(4),HIGH,TB,0),ALIGN2,PXUP30,color808000;
DRAWNUMBER(DFFX AND LOW<>SYSPARAM(5),LOW,TB,0),ALIGN0,PXDN5,color808000;
DRAWNUMBER(UFFX AND HIGH<>SYSPARAM(4),HIGH*A,ATH,0),ALIGN0,PXUP55,color80;
DRAWNUMBER(UFFX AND HIGH=SYSPARAM(4),HIGH*A,ATH,0),ALIGN2,PXUP55,color80;
DRAWNUMBER(DFFX AND LOW<>SYSPARAM(5),LOW*A,ABL,0),ALIGN0,PXDN28,color80;
END;
ZSUN5:=IF(LOW>=REF(LOW,PED),5/(CLOSE/(REF(LOW,PED)/1.005)-1),0);
ZSUN3:=IF(LOW>=REF(LOW,PED),3/(CLOSE/(REF(LOW,PED)/1.005)-1),0);
ZSUN1:=IF(LOW>=REF(LOW,PED),1/(CLOSE/(REF(LOW,PED)/1.005)-1),0);
STOP:=IF(LOW>=REF(LOW,PED),REF(LOW,PED)/1.005,LOW/1.005);
DRAWTEXT(BARPOS=SYSPARAM(1),BOT*1.02,'5%止损:仓位-价位:'),ALIGN1,SHIFT5,PXUP127,colorFFFF;
DRAWTEXT(BARPOS=SYSPARAM(1),BOT*1.02,'3%止损:仓位-价位:'),ALIGN1,SHIFT5,PXUP70,colorFF00FF;
DRAWTEXT(BARPOS=SYSPARAM(1),BOT*1.02,'1%止损:仓位-价位:'),ALIGN1,SHIFT5,PXUP18,colorFF0000;
DRAWNUMBER(BARPOS=SYSPARAM(1),BOT*1.02,FLOOR(ZSUN5),0),ALIGN2,SHIFT8,PXUP100,colorFFFF;
DRAWNUMBER(BARPOS=SYSPARAM(1),BOT*1.02,FLOOR(ZSUN3),0),ALIGN2,SHIFT8,PXUP45,colorFF00FF;
DRAWNUMBER(BARPOS=SYSPARAM(1),BOT*1.02,FLOOR(ZSUN1),0),ALIGN2,SHIFT8,PXDN6,colorFF0000;
DRAWNUMBER(BARPOS=SYSPARAM(1),BOT*1.02,STOP,2),ALIGN1,SHIFT10,PXUP100,colorFFFF;
DRAWNUMBER(BARPOS=SYSPARAM(1),BOT*1.02,STOP,2),ALIGN1,SHIFT10,PXUP45,colorFF00FF;
DRAWNUMBER(BARPOS=SYSPARAM(1),BOT*1.02,STOP,2),ALIGN1,SHIFT10,PXDN6,colorFF0000;