DH1:=IF(H<REF(H,1) AND L>REF(L,1),H-L,0);
DH2:=IF(REF(H,1)<H AND REF(L,1)>L,REF(H,1)-REF(L,1),0);
DH3:=IF(REF(H,1) AND H>REF(L,1),H-REF(L,1),0);
DH4:=IF(H>REF(H,1) AND L<REF(H,1),REF(H,1)-L,0);
DH0:=IF(H<REF(L,1) OR L>REF(H,1),0,DH1+DH2+DH3);
DH:=DH0/(H-L)*100;
MDH:SUM(DH0,5);