通达信仓位量化管理主图指标公式源码

以下是指标网提供的通达信仓位量化管理主图指标公式源码:

DRAWGBK(C>0, RGB(40,120,20),RGB(00,00,00),0,0,1),LINETHICK2;

DRAWTEXT_FIX(1,0.00,0.00,0,'【仓位量化管理】'),COLORFF00FF;

DRAWTEXT_FIX(1,0.00,0.05,0,'【1、紫+红=满仓,2、紫+绿=6成,3、蓝+红=4成,4、蓝+绿=空仓铁的纪律,严格遵守!】'),COLOR00FFFF;

VAR1:=IF(YEAR>2999 AND MONTH>5,0,1);

VAR2:=IF(HIGH=CLOSE,1.10*CLOSE,HIGH)*VAR1;

VAR3:=IF(HIGH=CLOSE,0.90*CLOSE,LOW)*VAR1;

短期值1:=EMA((HIGH+LOW)/2,5);

顶部线1:=EMA(EMA(VAR2,6)*1.05,8);

底部线1:=EMA(EMA(VAR3,6)*0.97,8);

VARA1:=EXPMA(CLOSE,5);

VARB1:=EXPMA(CLOSE,10);

VARC1:=EXPMA(CLOSE,20);

VARD1:=EXPMA(CLOSE,50);

VARE1:=(VARA1+VARB1+VARC1+VARD1)/4;

天线1:MA(VARE1,4);

天线2:=MA(VARE1,5)+MA(VARE1,5)*0.03;

天线3:MA(VARE1,4)-MA(VARE1,4)*0.03;

NOTEXT天线01:IF(天线1>REF(天线1,1),天线1,DRAWNULL),COLORRED;

NOTEXT天线11:IF(天线1<REF(天线1,1),天线1,DRAWNULL),COLORGREEN;

NOTEXT天线03:IF(天线3>REF(天线3,1),天线3,DRAWNULL),COLORRED;

NOTEXT天线13:IF(天线3<REF(天线3,1),天线3,DRAWNULL),COLORGREEN;

STICKLINE(天线1>REF(天线1,1),天线1,天线3,0,0),COLORRED;

STICKLINE(天线1<REF(天线1,1),天线1,天线3,0,0),COLORGREEN;

空:=REF(C,1)>REF(天线3,1) AND C<天线3;

多:=REF(C,1)<REF(天线1,1) AND C>天线1;

空1:=TFILTER(多,空,2);

多1:=TFILTER(多,空,1);

VAR11:=IF(YEAR>2999 AND MONTH>5,0,1);

VAR12:=IF(HIGH=CLOSE,1.10*CLOSE,HIGH)*VAR11;

VAR13:=IF(HIGH=CLOSE,0.90*CLOSE,LOW)*VAR11;

长期值2:=EMA((HIGH+LOW)/2,5);

顶部线2:=EMA(EMA(VAR12,6)*1.05,8);

底部线2:=EMA(EMA(VAR13,6)*0.97,8);

VAR18:=(HIGH+LOW+CLOSE)/3;

VARA2:=EMA(CLOSE,5);

VARB2:=EMA(CLOSE,10);

VARC2:=EMA(CLOSE,20);

VARD2:=EMA(CLOSE,50);

VARE2:=(VARA2+VARB2+VARC2+VARD2)/4;

天线12:=EMA(VARE2,60);

天线22:=EMA(VARE2,60)+EMA(VARE2,60)*0.03;

天线32:=EMA(VARE2,55)-EMA(VARE2,55)*0.03;

NOTEXT天线012:IF(天线12>REF(天线12,1),天线12,DRAWNULL),COLORMAGENTA;

NOTEXT天线112:IF(天线12<REF(天线12,1),天线12,DRAWNULL),COLORBLUE;

NOTEXT天线032:IF(天线32>REF(天线32,1),天线32,DRAWNULL),COLORMAGENTA;

NOTEXT天线132:IF(天线32<REF(天线32,1),天线32,DRAWNULL),COLORBLUE;

STICKLINE(天线12>REF(天线12,1),天线12,天线32,0,0),COLORMAGENTA;

STICKLINE(天线12<REF(天线12,1),天线12,天线32,0,0),COLORBLUE;

DRAWKLINE(HIGH,OPEN,LOW,CLOSE);

A1:=C>REF(C,4);

NT:=BARSLASTCOUNT(A1);

TJ11:=NT=9;

TJ13:=ISLASTBAR AND BETWEEN(NT,5,8);

AY:=(BACKSET(TJ11>0,9) OR BACKSET(TJ13>0,NT))*NT;

DRAWTEXT(AY>0,H*1.02,VAR2STR(AY,0)),COLORFF00FF;

DRAWTEXT(NT=9,H*1.02,'9'),COLORGREEN;

B1:=C<REF(C,4);

NT0:=BARSLASTCOUNT(B1);

TJ21:=NT0=9 ;

TJ23:=ISLASTBAR AND BETWEEN(NT0,5,8);

AY1:=(BACKSET(TJ21>0,9) OR BACKSET(TJ23>0,NT0))*NT0;

DRAWTEXT(AY1>0,L*0.98,VAR2STR(AY1,0)),COLORFF00FF;

DRAWTEXT(NT0=9,L*0.98,'9'),COLORGREEN;

AR3:=LLV(HIGH,240);

AR4:=100*(CLOSE-AR3)/AR3;

AR5:=(CLOSE-LLV(LOW,528))/(HHV(HIGH,528)-LLV(LOW,528))*100;

AR6:=(CLOSE-LLV(CLOSE,530))/(HHV(CLOSE,530)-LLV(CLOSE,530))*100;

AR7:=0;

AR8:=SMA(MAX(CLOSE-REF(CLOSE,1),0),34,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),7,1)*100;

AR9:=SMA(MAX(CLOSE-REF(CLOSE,1),0),13,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),13,1)*100;

AR10:=IF(TROUGHBARS(3,16,1)=0 AND HIGH>LOW+0.04,4,0);

AR11:=ZIG(3,6)>REF(ZIG(3,6),1) AND REF(ZIG(3,6),1)<=REF(ZIG(3,6),2) AND REF(ZIG(3,6),2)<=REF(ZIG(3,6),3);

AR12:=ZIG(3,6)<REF(ZIG(3,6),1) AND REF(ZIG(3,6),1)>=REF(ZIG(3,6),2) AND REF(ZIG(3,6),2)>=REF(ZIG(3,6),3);

AR13:=ZIG(3,22)>REF(ZIG(3,22),1) AND REF(ZIG(3,22),1)<=REF(ZIG(3,22),2) AND REF(ZIG(3,22),2)<=REF(ZIG(3,22),3);

AR14:=ZIG(3,22)<REF(ZIG(3,22),1) AND REF(ZIG(3,22),1)>=REF(ZIG(3,22),2) AND REF(ZIG(3,22),2)>=REF(ZIG(3,22),3);

AR15:=ZIG(3,51)>REF(ZIG(3,51),1) AND REF(ZIG(3,51),1)<=REF(ZIG(3,51),2) AND REF(ZIG(3,51),2)<=REF(ZIG(3,51),3);

AR16:=ZIG(3,51)<REF(ZIG(3,51),1) AND REF(ZIG(3,51),1)>=REF(ZIG(3,51),2) AND REF(ZIG(3,51),2)>=REF(ZIG(3,51),3);

AR17:=ZIG(3,72)>REF(ZIG(3,72),1) AND REF(ZIG(3,72),1)<=REF(ZIG(3,72),2) AND REF(ZIG(3,72),2)<=REF(ZIG(3,72),3);

AR18:=ZIG(3,72)<REF(ZIG(3,72),1) AND REF(ZIG(3,72),1)>=REF(ZIG(3,72),2) AND REF(ZIG(3,72),2)>=REF(ZIG(3,72),3);

AR19:=EMA(CLOSE,2)-EMA(CLOSE,150);

买1:=AR10;

买2:=(AR11+AR13+AR15+AR17);

卖1:=(AR12+AR14+AR16+AR18);

DRAWTEXT(买1>0 OR 买2>0,LOW*0.99,'买'),COLORRED;

DRAWTEXT(卖1>0,HIGH*1,'止盈'),COLORGREEN;