本人改良了决策曲线副图指标看起来更清爽一些
MA1:=MA(CLOSE,5);
MA2:=MA(CLOSE,10);
P01:=IF(MA1>MA2,1,IF(MA2>MA1,-1,0));
MA3:=MA(CLOSE,3);
MA4:=MA(CLOSE,5);
P02:=IF(MA3>MA4,1,IF(MA4>MA3,-1,0));
MA5:=MA(CLOSE,12);
MA6:=MA(CLOSE,50);
P03:=IF(MA5>MA6,1,IF(MA6>MA5,-1,0));
{KDJ}
RSV:=(CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*100;
K:=EMA(RSV,3);
D:=EMA(K,3);
P04:=IF(K>D,1,IF(D>K,-1,0));
{MACD}
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
P05:=IF(DIF>DEA,1,IF(DEA>DIF,-1,0));
{TRIX}
TR2:=EMA(EMA(EMA(CLOSE,12),12),12);
TRIX:=(TR-REF(TR,1))/REF(TR,1)*100;
MATRIX:=MA(TRIX,9) ;
P06:=IF(TRIX>MATRIX,1,IF(MATRIX>TRIX,-1,0));
{DMI}
TR1:=EMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),7);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EMA(IF(HD>0 AND HD>LD,HD,0),7);
DMM:=EMA(IF(LD>0 AND LD>HD,LD,0),7);
PDI:= DMP*100/TR;
MDI:= DMM*100/TR;
ADX:= EMA(ABS(MDI-PDI)/(MDI+PDI)*100,7);
ADXR:=EMA(ADX,7);
P07:=IF(PDI>MDI AND ADX>PDI AND ADX>50,3,
IF(PDI<MDI AND ADX>MDI AND ADX>50,-3,0));{9}
{RSI}
LC:=REF(CLOSE,1);
RSI1:=EMA(MAX(CLOSE-LC,0),5)/EMA(ABS(CLOSE-LC),5)*100;{10}
P08:=IF(RSI1>80,1,IF(RSI1<20,-1,0));{10}
{CCI}
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,8))/(0.015*AVEDEV(TYP,8));
P09:=IF(CCI>180,2,IF(CCI<-180,-2,0));{12}
{W%R}
WR1:=(CLOSE-LLV(LOW,6))/(HHV(HIGH,6)-LLV(LOW,6))*100;
P10:= IF(WR1>80,1,IF(WR1<20,-1,0));{13}
{OSC}
OSC:=100*(CLOSE-MA(CLOSE,20));
P11:=IF(OSC>0,1,IF(OSC<0,-1,0));{14}
{MTM}
MOM:=CLOSE-REF(CLOSE,7);
P12:=IF(MOM>0,1,IF(MOM<0,-1,0));{15}
{DPO}
DPO:=CLOSE-REF(MA(CLOSE,11),11/2+1);
P13:=IF(DPO>0,1,IF(DPO<0,-1,0));{16}
{布林线}
MB:=MA(CLOSE,12);
R:=(CLOSE-MB)*(CLOSE-MB);
X1:=MA(R,12);
X2:=SQRT(X1);
D1:=1;
UPPER:=MB+(D1*X2);
LOWER:=MB-(D1*X2);
P14:=IF(CLOSE>UPPER,2,IF(CLOSE<LOWER,-2,0));{18}
{BRAR}
BR:=SUM(MAX(0,HIGH-REF(CLOSE,1)),14)/SUM(MAX(0,REF(CLOSE,1)-LOW),14)*100;
AR:=SUM(HIGH-OPEN,14)/SUM(OPEN-LOW,14)*100;
P15:=IF(BR>350 OR AR>180,3,IF(BR<45 OR AR<45,-3,0));{21}
{VR}
TH:=SUM(IF(CLOSE>REF(CLOSE,1),VOL,0),14);
TL:=SUM(IF(CLOSE<REF(CLOSE,1),VOL,0),14);
TQ:=SUM(IF(CLOSE=REF(CLOSE,1),VOL,0),14);
VR:=0100*(TH*2+TQ)/(TL*2+TQ);
P16:=IF(VR>350,3,IF(VR<45,-3,0));{24}
{WVAD}
WVAD:=SUM((CLOSE-OPEN)/(HIGH-LOW)*VOL,6)/10000;
P17:=IF(WVAD>0,1,IF(WVAD<0,-1,0));{25}
{EMV}
VOLUME:=MA(VOL,4)/VOL;
MID:=100*(HIGH+LOW-REF(HIGH+LOW,1))/(HIGH+LOW);
EMV:=MA(MID*VOLUME*(HIGH-LOW)/MA(HIGH-LOW,4),4);
P18:=IF(EMV>0,1,IF(EMV<0,-1,0));{26}
{OBV}
VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);
OBV:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0);
MAOBV:=EMA(OBV,24);
P19:=IF(OBV>MAOBV,1,IF(OBV<MAOBV,-1,0));{27}
{PVI}
PVI:= PVI,COLORWHITE;
MPVI:=EMA(PVI,24),COLORYELLOW;
P20:=IF(PVI>MPVI,1,IF(PVI<MPVI,-1,0));{28}
{NVI}
NVI:=NVI,COLORWHITE;
MNVI:=EMA(NVI,24),COLORYELLOW;
P21:=IF(NVI>MNVI,2,IF(NVI<MNVI,-2,0));{30}
{MASS}
MASS:=SUM(MA(HIGH-LOW,9)/MA(MA(HIGH-LOW,9),9),25);
MA7:=MA(CLOSE,9);
P22:=IF(MA7>REF(MA7,1) AND MASS>26.5,2,IF(MA7<REF(MA7,1)
AND MASS<26.5,-2,0));{32}
{VHF}
NUM:=ABS(HHV(HIGH,15)-LLV(LOW,15));
DEN:=SUM(ABS(CLOSE-REF(CLOSE,1)),15);
VHF:=IF(DEN=0,0,NUM/DEN);
VHF1:=EMA(VHF,240);
P23:=IF(VHF>VHF1,1,IF(VHF<VHF1,-1,0));{33}
{PUCU}
PU:=MA(CLOSE,13);
CU:=MA(VOL,13);
PU1:=(PU-REF(PU,1))/REF(PU,1)*100;
CU1:=(CU-REF(CU,1))/REF(CU,1)*100;
逆时针曲线:=PU1+CU1;
P24:=IF(逆时针曲线>REF(逆时针曲线,1),1,IF(逆时针曲线<REF(逆时针曲线,1),-1,0));
{ASI}
LC2:=REF(CLOSE,1);
AA:=ABS(HIGH-LC2);
BB:=ABS(LOW-LC2);
CC:=ABS(HIGH-REF(LOW,1));
DD:=ABS(LC2-REF(OPEN,1));
R2:=IF(AA>BB AND AA>CC,AA+BB/2+DD/4,IF(BB>CC AND BB>AA,BB+AA/2+DD/4,CC+DD/4));
X01:=(CLOSE-LC2+(CLOSE-OPEN)/2+LC2-REF(OPEN,1));
SI:=16*X01/R2*MAX(AA,BB);
ASI:=SUM(SI,0),COLORWHITE;
MASI:=MA(ASI,6),COLORYELLOW;
P25:=IF(CLOSE<HHV(CLOSE,13) AND ASI=HHV(ASI,13),1,IF(CLOSE>LLV(CLOSE,13) AND ASI=LLV(ASI,13),-1,0));
{BIAS}
BIAS1 :=(CLOSE-MA(CLOSE,12))/MA(CLOSE,12)*100;
P26:=IF(BIAS1>10,1,IF(BIAS1<-10,-1,0));
决策曲线: (36+P01+P02+P03+P04+P05+P06+P07+P08+P09+P10+P11+P12+P13+P14+P15+P16+
P17+P18+P19+P20+P21+P22+P23+P24+P25+P26)*1.36,COLORMAGENTA;
MAJCQX:MA(决策曲线,3)COLORWHITE,NODRAW ;
STICKLINE(C>0,20,20,10,0),COLORYELLOW;
STICKLINE(C>0,75,75,10,0),COLORBROWN;
STICKLINE(C>0,82.5,82.5,10,0),COLORLIBLUE;
STICKLINE(C>0,27.5,27.5,10,0),COLORLIRED;
DRAWTEXT(CROSS( 决策曲线,20),22.5,'↙买点'),COLORRED;
DRAWTEXT(CROSS( 决策曲线,27.5),30,'↙加仓'),COLORWHITE;
DRAWTEXT(CROSS(82.5, 决策曲线),80,'↖清仓'),COLORYELLOW;
DRAWTEXT(CROSS(75, 决策曲线),72.5,'↖卖点'),COLORGREEN;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
MA1赋值:收盘价的5日简单移动平均
MA2赋值:收盘价的10日简单移动平均
P01赋值:IF(MA1>MA2,1,IF(MA2>MA1,-1,0))
MA3赋值:收盘价的3日简单移动平均
MA4赋值:收盘价的5日简单移动平均
P02赋值:IF(MA3>MA4,1,IF(MA4>MA3,-1,0))
MA5赋值:收盘价的12日简单移动平均
MA6赋值:收盘价的50日简单移动平均
P03赋值:IF(MA5>MA6,1,IF(MA6>MA5,-1,0))
{KDJ}
RSV赋值:(收盘价-5日内最低价最低值)/(5日内最高价最高值-5日内最低价最低值)*100
K赋值:RSV的3日指数移动平均
D赋值:K的3日指数移动平均
P04赋值:IF(K>D,1,IF(D>K,-1,0))
{MACD}
DIF:=收盘价的12日指数移动平均-收盘价的26日指数移动平均
DEA:=DIF的9日指数移动平均
MACD赋值:(DIF-DEA)*2
P05赋值:IF(DIF>DEA,1,IF(DEA>DIF,-1,0))
{TRIX}
TR2赋值:收盘价的12日指数移动平均,12),12)
TRIX赋值:(TR-1日前的TR)/1日前的TR*100
MATRIX赋值:TRIX的9日简单移动平均
P06赋值:IF(TRIX>MATRIX,1,IF(MATRIX>TRIX,-1,0))
{DMI}
TR1赋值:EMA(MAX(MAX(最高价-最低价,最高价-1日前的收盘价的绝对值),ABS(1日前的收盘价-最低价)),7)
HD :=最高价-1日前的最高价
LD :=1日前的最低价-最低价
如果HD>0 AND HD>LD返回HD否则返回0
如果LD>0 AND LD>HD返回LD否则返回0
PDI赋值: DMP*100/TR
MDI赋值: DMM*100/TR
ADX赋值: EMA(MDI-PDI的绝对值/(MDI+PDI)*100,7)
ADXR:=ADX的7日指数移动平均
P07赋值:IF(PDI>MDI AND ADX>PDI AND ADX>50,3,
IF(PDIMDI AND ADX>50,-3,0))
{9}
{RSI}
LC赋值:1日前的收盘价
RSI1赋值:E收盘价-LC和0较大值的5日简单移动平均/EMA(收盘价-LC的绝对值,5)*100
{10}
P08赋值:IF(RSI1>80,1,IF(RSI1<20,-1,0))
{10}
{CCI}
TYP赋值:(最高价+最低价+收盘价)/3
CCI赋值:(TYP-TYP的8日简单移动平均)/(0.015*AVEDEV(TYP,8))
P09赋值:IF(CCI>180,2,IF(CCI<-180,-2,0))
{12}
{W%R}
WR1赋值:(收盘价-6日内最低价最低值)/(6日内最高价最高值-6日内最低价最低值)*100
P10赋值: IF(WR1>80,1,IF(WR1<20,-1,0))
{13}
{OSC}
OSC赋值:100*(收盘价-收盘价的20日简单移动平均)
P11赋值:IF(OSC>0,1,IF(OSC<0,-1,0))
{14}
{MTM}
MOM赋值:收盘价-7日前的收盘价
P12赋值:IF(MOM>0,1,IF(MOM<0,-1,0))
{15}
{DPO}
DPO:=收盘价-REF(收盘价的11日简单移动平均,11/2+1)
P13赋值:IF(DPO>0,1,IF(DPO<0,-1,0))
{16}
{布林线}
MB赋值:收盘价的12日简单移动平均
R赋值:(收盘价-MB)*(收盘价-MB)
X1赋值:R的12日简单移动平均
X2赋值:SQRT(X1)
D1:=1
UPPER赋值:MB+(D1*X2)
LOWER赋值:MB-(D1*X2)
P14赋值:IF(收盘价>UPPER,2,IF(收盘价<最低价ER,-2,0))
{18}
{BRAR}
BR赋值:14的0和最高价-1日前的收盘价较大值日累和/14的0和1日前的收盘价-最低价较大值日累和*100
AR赋值:14的最高价-开盘价日累和/14的开盘价-最低价日累和*100
P15赋值:IF(BR>350 OR AR>180,3,IF(BR<45 OR AR<45,-3,0))
{21}
{VR}
TH赋值:SUM(IF(收盘价>1日前的收盘价,成交量,0),14)
TL赋值:SUM(IF(收盘价<1日前的收盘价,成交量,0),14)
TQ赋值:SUM(IF(收盘价=1日前的收盘价,成交量,0),14)
VR赋值:0100*(TH*2+TQ)/(TL*2+TQ)
P16赋值:IF(VR>350,3,IF(VR<45,-3,0))
{24}
{WVAD}
WVAD赋值:SUM((收盘价-开盘价)/(最高价-最低价)*成交量,6)/10000
P17赋值:IF(WVAD>0,1,IF(WVAD<0,-1,0))
{25}
{EMV}
VOLUME赋值:成交量的4日简单移动平均/成交量
MID赋值:100*(最高价+最低价-1日前的最高价+最低价)/(最高价+最低价)
EMV赋值:MA(MID*成交量UME*(最高价-最低价)/MA(最高价-最低价,4),4)
P18赋值:IF(EMV>0,1,IF(EMV<0,-1,0))
{26}
{OBV}
VA赋值:IF(收盘价>1日前的收盘价,成交量,-成交量)
OBV赋值:SUM(IF(收盘价=1日前的收盘价,0,VA),0)
MAOBV赋值:OBV的24日指数移动平均
P19赋值:IF(OBV>MAOBV,1,IF(OBV{27}
{PVI}
PVI赋值: PVI,画白色
MPVI赋值:PVI的24日指数移动平均,画黄色
P20赋值:IF(PVI>MPVI,1,IF(PVI{28}
{NVI}
NVI赋值:NVI,画白色
MNVI赋值:NVI的24日指数移动平均,画黄色
P21赋值:IF(NVI>MNVI,2,IF(NVI{30}
{MASS}
MASS赋值:SUM(最高价-最低价的9日简单移动平均/最高价-最低价的9日简单移动平均的9日简单移动平均,25)
MA7赋值:收盘价的9日简单移动平均
P22赋值:IF(MA7>1日前的MA7 AND MASS>26.5,2,IF(MA7<1日前的MA7
AND MASS<26.5,-2,0))
{32}
{VHF}
NUM赋值:15日内最高价最高值-15日内最低价最低值的绝对值
DEN:=SUM(收盘价-1日前的收盘价的绝对值,15)
如果DEN=0返回0否则返回NUM/DEN
VHF1:=VHF的240日指数移动平均
P23赋值:IF(VHF>VHF1,1,IF(VHF{33}
{PUCU}
PU赋值:收盘价的13日简单移动平均
CU赋值:成交量的13日简单移动平均
PU1赋值:(PU-1日前的PU)/1日前的PU*100
CU1:=(CU-1日前的CU)/1日前的CU*100
逆时针曲线赋值:PU1+CU1
P24赋值:IF(逆时针曲线>1日前的逆时针曲线,1,IF(逆时针曲线<1日前的逆时针曲线,-1,0))
{ASI}
LC2赋值:1日前的收盘价
AA赋值:最高价-LC2的绝对值
BB赋值:最低价-LC2的绝对值
CC赋值:最高价-1日前的最低价的绝对值
DD:=LC2-1日前的开盘价的绝对值
R2:=IF(AA>BB AND AA>CC,AA+BB/2+DD/4,IF(BB>CC AND BB>AA,BB+AA/2+DD/4,CC+DD/4))
X01赋值:(收盘价-LC2+(收盘价-开盘价)/2+LC2-1日前的开盘价)
SI赋值:16*X01/R2*AA和BB较大值
ASI赋值:0的SI日累和,画白色
MASI赋值:ASI的6日简单移动平均,画黄色
P25赋值:IF(收盘价<13日内收盘价最高值 AND ASI=13日内ASI最高值,1,IF(收盘价>13日内收盘价最低值 AND ASI=13日内ASI最低值,-1,0))
{BIAS}
BIAS1 :=(收盘价-收盘价的12日简单移动平均)/收盘价的12日简单移动平均*100
P26赋值:IF(BIAS1>10,1,IF(BIAS1<-10,-1,0))
输出
决策曲线: (36+P01+P02+P03+P04+P05+P06+P07+P08+P09+P10+P11+P12+P13+P14+P15+P16+
P17+P18+P19+P20+P21+P22+P23+P24+P25+P26)*1.36,画洋红色
输出
MAJCQX:决策曲线的3日简单移动平均画白色,NODRAW
当满足条件C>0时,在20和20之间画柱状线
当满足条件C>0时,在75和75之间画柱状线
当满足条件C>0时,在82.5和82.5之间画柱状线
当满足条件C>0时,在27.5和27.5之间画柱状线
DRAWTEXT( 决策曲线上穿20,22.5,'↙买点'),画红色
DRAWTEXT( 决策曲线上穿27.5,30,'↙加仓'),画白色
DRAWTEXT(82.5上穿 决策曲线,80,'↖清仓'),画黄色
DRAWTEXT(75上穿 决策曲线,72.5,'↖卖点'),画绿色