先建立一个引用公式,源码只有一行,公式名称不要更改,就叫:生命线
生命线:EMA(C,55);
然后建立下面的主图公式
{综合分析}
M1:=5;
财务数据:=0;
短买信号:=10;
画趋势线:=10;
黄金分割:=120;
VAR100:=1;
MA1:MA(C,M1)COLORWHITE;
JRH:=HHV(C,2)*VAR100;
JRL:=LLV(C,2)*VAR100;
VAR101:=(CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2))*VAR100;
VAR102:=(REF(VAR101,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR103:=(REF(VAR102,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR104:=(REF(VAR103,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR105:=(REF(VAR104,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR106:=(REF(VAR105,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR107:=(REF(VAR106,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR108:=(REF(VAR107,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR109:=(REF(VAR108,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARA:=(REF(VAR109,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VARB:=(REF(VARA,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARC:=(REF(VARB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VARD:=(CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2));
VARE:=(REF(VARD,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2))*VAR100;
VARF:=(REF(VARE,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2))*VAR100;
VAR010:=(REF(VARF,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2))*VAR100;
VAR011:=(REF(VAR010,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2))*VAR100;
VAR012:=(REF(VAR011,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2))*VAR100;
VAR013:=(REF(VAR012,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2))*VAR100;
VAR014:=(REF(VAR013,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2))*VAR100;
VAR015:=(REF(VAR014,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2))*VAR100;
VAR016:=(REF(VAR015,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2))*VAR100;
VAR017:=(REF(VAR016,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2))*VAR100;
VAR018:=(REF(VAR017,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2))*VAR100;
VAR019:=((REF(VARD OR VARE OR VARF OR VAR010 OR VAR011 OR VAR012 OR VAR013 OR VAR014 OR VAR015 OR VAR016 OR VAR017 OR VAR018,1)) AND VAR101)*VAR100;
VAR1A:=((REF(VAR101 OR VAR102 OR VAR103 OR VAR104 OR VAR105 OR VAR106 OR VAR107 OR VAR108 OR VAR109 OR VARA OR VARB OR VARC,1)) AND VARD)*VAR100;
红色持股:=VAR101 OR VAR102 OR VAR103 OR VAR104 OR VAR105 OR VAR106 OR VAR107 OR VAR108 OR VAR109 OR VARA OR VARB OR VARC,COLOR0000FF,NODRAW;
离场:=IF(红色持股,JRL,DRAWNULL)*VAR100;
明离场价:离场,COLORFF99FF,NODRAW;
青色观望:=VARD OR VARE OR VARF OR VAR010 OR VAR011 OR VAR012 OR VAR013 OR VAR014 OR VAR015 OR VAR016 OR VAR017 OR VAR018,COLORFFFF00,NODRAW;
进:=IF(青色观望,JRH,DRAWNULL)*VAR100;
离场价:=REF(离场,1),COLORMAGENTA,NODRAW;
明短买价:进,COLOR33AACC,NODRAW;
短买价:=REF(明短买价,1)*VAR100,COLORYELLOW,NODRAW;
今获利:=WINNER(C)*100,COLORWHITE,NODRAW;
昨获利:=REF(今获利,1),COLORYELLOW,NODRAW;
获利比增:=今获利-昨获利,COLORRED,NODRAW;
平均成本:((COST(90)+COST(70)+COST(50)+COST(30)+COST(10))/5)*VAR100,LINETHICK2,COLORWHITE;
DRAWTEXT(ISLASTBAR,平均成本,'←平均成本'),COLORYELLOW;
IF(平均成本<C,平均成本,DRAWNULL)*VAR100,LINETHICK2,COLORLIRED;
趋势线:((MA(C,5)+MA(C,10)+MA(C,15)+MA(C,20))/4)*VAR100,LINETHICK2,COLORGREEN;
IF(趋势线>REF(趋势线,1),趋势线,DRAWNULL)*VAR100,LINETHICK2,COLORRED;
辅助线:MA(C,26)*VAR100,COLORFF00FF,LINETHICK2;
IF(辅助线<REF(辅助线,1),辅助线,DRAWNULL)*VAR100,LINETHICK2,COLOR669933;
周生命:"生命线.生命线#WEEK",CIRCLEDOT,COLORLIGREEN;
生命线:EMA(C,55)*VAR100, CIRCLEDOT,COLORYELLOW;
VAR1MZ:=((CLOSE > REF(CLOSE,1)) AND (CLOSE > REF(CLOSE,2)))*VAR100;
VAR2MZ:=((REF(VAR1MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR3MZ:=((REF(VAR2MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR4MZ:=((REF(VAR3MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR5MZ:=((REF(VAR4MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR6MZ:=((REF(VAR5MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR7MZ:=((REF(VAR6MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR8MZ:=((REF(VAR7MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR9MZ:=((REF(VAR8MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VARAMZ:=((REF(VAR9MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VARBMZ:=((REF(VARAMZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VARCMZ:=((REF(VARBMZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VARDMZ:=((CLOSE < REF(CLOSE,1)) AND (CLOSE < REF(CLOSE,2)))*VAR100;
VAREMZ:=((REF(VARDMZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VARFMZ:=((REF(VAREMZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR10MZ:=((REF(VARFMZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR11MZ:=((REF(VAR10MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR12MZ:=((REF(VAR11MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR13MZ:=((REF(VAR12MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR14MZ:=((REF(VAR13MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR15MZ:=((REF(VAR14MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR16MZ:=((REF(VAR15MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR17MZ:=((REF(VAR16MZ,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR18MZ:=((REF(VAR17MZ,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR19MZ:=(REF((((((((((((VARDMZ OR VAREMZ) OR VARFMZ) OR VAR10MZ) OR VAR11MZ) OR VAR12MZ) OR VAR13MZ) OR VAR14MZ) OR VAR15MZ) OR VAR16MZ) OR VAR17MZ) OR VAR18MZ),1) AND VAR1MZ AND CURRBARSCOUNT<短买信号);
VAR1AMZ:=(REF((((((((((((VAR1MZ OR VAR2MZ) OR VAR3MZ) OR VAR4MZ) OR VAR5MZ) OR VAR6MZ) OR VAR7MZ) OR VAR8MZ) OR VAR9MZ) OR VARAMZ) OR VARBMZ) OR VARCMZ),1) AND VARDMZ AND CURRBARSCOUNT<短买信号);
箱顶:IF(CURRBARSCOUNT<=黄金分割, CONST(IF(ISLASTBAR=1,HHV(H, BARSLAST(CURRBARSCOUNT=黄金分割)),1)),DRAWNULL)COLOR888888;
箱低:IF(CURRBARSCOUNT<=黄金分割, CONST(IF(ISLASTBAR=1,LLV(L, BARSLAST(CURRBARSCOUNT=黄金分割)),1)),DRAWNULL)COLOR888888;
零点382:箱顶-(箱顶-箱低)*0.382,DOTLINE,COLOR888888;
零点5:箱顶-(箱顶-箱低)*0.5,DOTLINE,COLOR888888;
零点618:箱顶-(箱顶-箱低)*0.618,DOTLINE,COLOR888888;
DRAWTEXT(ISLASTBAR,箱顶,'顶'),COLOR888888;
DRAWTEXT(ISLASTBAR,箱低,'低'),COLOR888888;
AA:=REF(H,画趋势线)=HHV(H,2*画趋势线+1);
QY:=BACKSET(AA,画趋势线+1);
CC:=FILTER(QY,画趋势线) AND H=HHV(H,画趋势线+1);
DDD:=BARSLAST(CC);
GDTS:=IF(CC,CURRBARSCOUNT,0);
DINGBU:=IF(DDD,REF(H, |