价格分段横跨K线数处理的熵值指标
把最近30个交易日k线跨过的价格区间分成10段,每段价格横穿k线个数来求取概率,再根据10段区间概率去计算熵值结果。
HHN:=HHV(H,30); LLN:=LLV(L,30); UNIT:=(HHN-LLN)/10; HL0:=LLN; HL1:=LLN+UNIT; HL2:=LLN+2*UNIT; HL3:=LLN+3*UNIT; HL4:=LLN+4*UNIT; HL5:=LLN+5*UNIT; HL6:=LLN+6*UNIT; HL7:=LLN+7*UNIT; HL8:=LLN+8*UNIT; HL9:=LLN+9*UNIT; HL10:=HHN; P1:=(MAX(COUNT(BETWEEN(HL0,H,L),30),COUNT(BETWEEN(HL1,H,L),30))+1)/40; P2:=(MAX(COUNT(BETWEEN(HL1,H,L),30),COUNT(BETWEEN(HL2,H,L),30))+1)/40; P3:=(MAX(COUNT(BETWEEN(HL2,H,L),30),COUNT(BETWEEN(HL3,H,L),30))+1)/40; P4:=(MAX(COUNT(BETWEEN(HL3,H,L),30),COUNT(BETWEEN(HL4,H,L),30))+1)/40; P5:=(MAX(COUNT(BETWEEN(HL4,H,L),30),COUNT(BETWEEN(HL5,H,L),30))+1)/40; P6:=(MAX(COUNT(BETWEEN(HL5,H,L),30),COUNT(BETWEEN(HL6,H,L),30))+1)/40; P7:=(MAX(COUNT(BETWEEN(HL6,H,L),30),COUNT(BETWEEN(HL7,H,L),30))+1)/40; P8:=(MAX(COUNT(BETWEEN(HL7,H,L),30),COUNT(BETWEEN(HL8,H,L),30))+1)/40; P9:=(MAX(COUNT(BETWEEN(HL8,H,L),30),COUNT(BETWEEN(HL9,H,L),30))+1)/40; P10:=(MAX(COUNT(BETWEEN(HL9,H,L),30),COUNT(BETWEEN(HL10,H,L),30))+1)/40; 熵值:-1*(P1*LOG(P1)+P2*LOG(P2)+P3*LOG(P3)+P4*LOG(P4)+P5*LOG(P5)+P6*LOG(P6)+P7*LOG(P7)+P8*LOG(P8)+P9*LOG(P9)+P10*LOG(P10))/LOG(10);
标签: 熵值指标
版权声明:文章来自网络!方法技巧仅供参考!拾荒网10Huang.CN,财富在手十指紧握!与努力的人共勉!