N1:=50;N2:=55;N3:=25;
E:=HHV(HIGH,N1);
G:=LLV(LOW,N2);
F:=LLV(LOW,N3);
T1:=HHVBARS(HIGH,N1);
T2:=LLVBARS(LOW,N2);
T3:=LLVBARS(LOW,N3);
bf:IF((REF(C,T1)>REF(C,(T1+1))),E ,REF(H,(T1+1)));
HD1:=IF((G AND(T1-T2)<0),G,0);
QD1:=IF((F AND (T1-T3)>0),LLV(LOW,N3),0);
HD:IF (((REF(C,T2)-REF(O,T2))<0),HD1,REF(LOW,(T2+1)));
QD:IF (((REF(C,T3)-REF(O,T3))<0),QD1,REF(LOW,(T3+1)));
A:SUM(vol,((LLVBARS(LOW,N2)-HHVBARS(HIGH,N1))));
B:SUM(VOL,(((HHVBARS(HIGH,N1)-LLVBARS(LOW,N3)))));
C:IF((bf=E),(T2-T1),(T2-T1-1)) ;
D:IF((bf=E),( T1-T3),(T1-T3+1));
M:(A/B)*618/1000+(D/C)+(E-QD)/(E-HD);