仓位控制通达信副图指标 有源码
VARPERIOD:=1;MID:=(3*C+L+H+O)/6;RISKC10:=Ema(WMA(MID,VARPERIOD),2);BasiCPROB:=33;ADDPROB:=42;LIMIT10:=2*MAX(Abs(HHV(H,5)-RISKC10),ABS(RISKC10-LLV(L,5)));PROB:=(1-ABS(C-RISKC10)/LIMIT10)*ADDPROB+BASICPROB;BUYPROBTJ:=RISKC10>REF(RISKC10,1) AND L>RISKC10;SELLPROBTJ:=RISKC10<=REF(RISKC10,1) AND H<RISKC10;开多获利概率:=IFF(BUYPROBTJ,PROB,IFF(RISKC10>REF(RISKC10,1),40*PROB/100,DRAWNULL));开空获利概率:=IFF(SELLPROBTJ,PROB,IFF(RISKC10<=REF(RISKC10,1),40*PROB/100,DRAWNULL));概率线:=IFF(BUYPROBTJ,PROB,IFF(RISKC10>REF(RISKC10,1),40*PROB/100,IFF(SELLPROBTJ,PROB,IFF(RISKC10<=REF(RISKC10,1),40*PROB/100,DRAWNULL))));仓位线:=EMA(EMA(IFF(概率线<=30,概率线*0.75,IFF(概率线>30 AND 概率线<=50,概率线*0.90,IFF(概率线>50 AND 概率线<=65,概率线*1.15,IFF(概率线>65 AND 概率线<=75,概率线*1.3,DRAWNULL)))),2),2);参考仓位:=仓位线;stICKLINE(仓位线<=30,0,仓位线,2,0),COLORFFFF00;STICKLINE(仓位线<=60 AND 仓位线>30,0,仓位线,2,0),COLORYELLOW;STICKLINE(仓位线>60,0,仓位线,2,0),COLORRED;较重仓位:IFF(仓位线>60,仓位线,DRAWNULL),NODRAW,COLORRED;中等仓位:IFF(仓位线<=60 AND 仓位线>30,仓位线,DRAWNULL),NODRAW,COLORYELLOW;较轻仓位:IFF(仓位线<=30,仓位线,DRAWNULL),NODRAW,COLORFFFF00;STICKLINE(VARPERIOD,0,0,30,0),COLORRED;仅限日线使用:IFF(PERIOD!=4,1,DRAWNULL),NODRAW,COLORWHITE;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
VARPERIOD赋值:1
MID赋值:(3*C+L+H+O)/6
RISKC10赋值:EWMID的VARPERIOD日简单移动平均,2)
BASICPROB赋值:33
ADDPROB赋值:42
LIMIT10赋值:2*MAX(5日内H最高值-RISKC10的绝对值,ABS(RISKC10-5日内L最低值))
PROB赋值:(1-C-RISKC10的绝对值/LIMIT10)*ADDPROB+BASICPROB
BUYPROBTJ:=RISKC10>1日前的RISKC10 AND L>RISKC10
SELLPROBTJ:=RISKC10<=1日前的RISKC10 AND H开多获利概率赋值:IFF(BUYPROBTJ,PROB,IFF(RISKC10>1日前的RISKC10,40*PROB/100,DRAWNULL))
开空获利概率赋值:IFF(SELLPROBTJ,PROB,IFF(RISKC10<=1日前的RISKC10,40*PROB/100,DRAWNULL))
概率线赋值:IFF(BUYPROBTJ,PROB,IFF(RISKC10>1日前的RISKC10,40*PROB/100,IFF(SELLPROBTJ,PROB,IFF(RISKC10<=1日前的RISKC10,40*PROB/100,DRAWNULL))))
仓位线赋值:EMA(EMA(IFF(概率线<=30,概率线*0.75,IFF(概率线>30 AND 概率线<=50,概率线*0.90,IFF(概率线>50 AND 概率线<=65,概率线*1.15,IFF(概率线>65 AND 概率线<=75,概率线*1.3,DRAWNULL)))),2),2)
参考仓位赋值:仓位线
当满足条件仓位线<=30时,在0和仓位线之间画柱状线
当满足条件仓位线<=60 AND 仓位线>30时,在0和仓位线之间画柱状线
当满足条件仓位线>60时,在0和仓位线之间画柱状线
输出较重仓位:IFF(仓位线>60,仓位线,DRAWNULL),NODRAW,画红色
输出中等仓位:IFF(仓位线<=60 AND 仓位线>30,仓位线,DRAWNULL),NODRAW,画黄色
输出较轻仓位:IFF(仓位线<=30,仓位线,DRAWNULL),NODRAW,COLORFFFF00
当满足条件VARPERIOD时,在0和0之间画柱状线
输出仅限日线使用:IFF(PERIOD!=4,1,DRAWNULL),NODRAW,画白色