分享一个我用的主图公式,大家看看能否优化一下,
红柱介入,但是需要优化
MA3:=MA(C,3);
YTSL:=(3*C+L+O+H)/6;
辰星线:=(20*YTSL+19*REF(YTSL,1)+18*REF(YTSL,2)+17*REF(YTSL,3)+16*REF(YTSL,4)+15*REF(YTSL,5)+14*REF(YTSL,6)+13*REF(YTSL,7)+12*REF(YTSL,8)+11*REF(YTSL,9)+10*REF(YTSL,10)+9*REF(YTSL,11)+8*REF(YTSL,12)+7*REF(YTSL,13)+6*REF(YTSL,14)+5*REF(YTSL,15)+4*REF(YTSL,16)+3*REF(YTSL,17)+2*REF(YTSL,18)+REF(YTSL,20))/211,COLORFFFF00;
牵牛线:=MA(C,26),COLOR669933;
等待:=IF(MA3<=辰星线,牵牛线,DRAWNULL);
中轨:=MA(C,26);
上轨:=中轨+STD(C,20);
下轨:=中轨-STD(C,20);
上极限:(中轨+2*STD(C,20)),COLORFF937F,LINETHICK2;
下极限:(中轨-2*STD(C,20)),COLORWHITE,LINETHICK2;
快线:=EMA(C,7)-EMA(C,21),LINETHICK2,COLORRED;
慢线:=MA(快线,4),COLORGREEN,LINETHICK2;
数值:=EMA((0.668*REF(快线,1)+0.333*快线),1),COLORSTICK;
X1:=V/SUM(V,13);
X2:=DMA(C,X1);
X3:=(C-X2)/X2*40;
L2:=MA(AMOUNT/(100*V),13);
CYS13:= (C-L2)/L2*100;
做多:=IF(快线>=数值,快线,数值);
做空:=IF(数值-快线,数值,快线);
强庄:STICKLINE(CYS13>5,L-0.22,L-0.35,2,0),COLORCYAN;
AAA:=(3*C+H+L+O)/6;
VAR1:(8*AAA+7*REF(AAA,1)+6*REF(AAA,2)+5*REF(AAA,3)+4*REF(AAA,4)+3*REF(AAA,5)+2*REF(AAA,6)+REF(AAA,8))/36,LINETHICK2,COLORRED;
VAR2:=(HHV(VAR1,2)+HHV(VAR1,4)+HHV(VAR1,8))/0;
VAR3:=(LLV(VAR1,2)+LLV(VAR1,4)+LLV(VAR1,8))/3;
VAR4:(HHV(VAR2,2)+HHV(VAR2,4)+HHV(VAR2,8))/0;
VAR5:(LLV(VAR3,2)+LLV(VAR3,4)+LLV(VAR3,8))/3,COLORRED;
VAR6:=(LLV(VAR1,2)+LLV(VAR1,4)+LLV(VAR1,8))/3;
{DRAWBAND(VAR1,RGB(155,50,50),VAR6,RGB(250,250,0));}
IF((VAR1 <= REF(VAR1,1)),VAR1,DRAWNULL),COLORGREEN,LINETHICK3;
IF((VAR1 >= REF(VAR1,1)),VAR1,DRAWNULL),COLORRED,LINETHICK3;
STICKLINE(VAR4>VAR1,VAR4,VAR1,0,0),COLORBLUE;
DRAWKLINE(H,O,L,C);
DRAWTEXT(REF(VAR5,1)=REF(VAR1,1) AND VAR5<VAR1,L*0.99,'↖买入'),COLORYELLOW;
DRAWTEXT(REF(VAR6,1)=REF(VAR1,1) AND VAR6<VAR1,L*0.92,'↖加仓'),COLORYELLOW;
CC:=((HIGH+LOW+CLOSE)/3-EMA((HIGH+LOW+CLOSE)/3,5))/(0.015*AVEDEV((HIGH+LOW+CLOSE)/3,5));
STICKLINE(CC>=0,LOW,HIGH,0.0,0),COLORRED;
STICKLINE(CC>=0,CLOSE,OPEN,3,1),COLORRED;
STICKLINE(CC<0,LOW,HIGH,0.0,0),COLORGREEN;
STICKLINE(CC<0,CLOSE,OPEN,3,1),COLORGREEN;
月DI:="MACD.DIF#MONTH";
月DE:="MACD.DEA#MONTH";
周DI:="MACD.DIF#WEEK";
周DE:="MACD.DEA#WEEK";
日DI:="MACD.DIF";
日DE:="MACD.DEA";
日金叉:=CROSS(日DI,日DE);
周金叉:=CROSS(周DI,周DE);
月金叉:=CROSS(月DI,月DE);
日穿0:=CROSS(日DI,0);
周穿0:=CROSS(周DI,0);
月穿0:=CROSS(月DI,0);
DRAWTEXT(日穿0,LOW-0.48,'↖日穿0'),COLORCYAN;
DRAWTEXT(周穿0,L*0.94,'↖周穿0'),COLORCYAN;
DRAWTEXT(月穿0,L*0.99,'↖月穿0'),COLORCYAN;
DRAWTEXT(日金叉,LOW-0.3,'↖日金叉'),COLORCYAN;
DRAWTEXT(周金叉,L*0.92,'↖周金叉'),COLORCYAN;
DRAWTEXT(月金叉,L*0.90,'↖月金叉'),COLORCYAN;