Ulcer Index TF:=Input("Time Factor",1,60,1); A4:=IsDefined(ExtFml("PowerPivots.Pivots")=4); A3:=IsDefined(ExtFml("PowerPivots.Pivots")=3); A2:=IsDefined(ExtFml("PowerPivots.Pivots")=2); A1:=IsDefined(ExtFml("PowerPivots.Pivots")=1); B4:=If(A4,ExtFml("PowerPivots.NthPivotPrice",4,0,TF),0); B3:=If(A3,ExtFml("PowerPivots.NthPivotPrice",3,0,TF),0); B2:=If(A2,ExtFml("PowerPivots.NthPivotPrice",2,0,TF),0); B1:=If(A1,ExtFml("PowerPivots.NthPivotPrice",1,0,TF),0); If(Max(B4,Max(B3,Max(B2,B1)))-C>0,Neg(Max(B4,Max(B3,Max(B2,B1)))-C),0); *****This formula corrects for the NA in an exploration ***** TF:=Input("Time Factor",1,60,1); A4:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=4),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=4),1,0)); A3:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=3),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=3),1,0)); A2:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=2),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=2),1,0)); A1:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=1),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=1),1,0)); B4:=If(A4=1,Highest(ValueWhen(1,A4=1,H)),0); B3:=If(A3=1,Highest(ValueWhen(1,A3=1,H)),0); B2:=If(A2=1,Highest(ValueWhen(1,A2=1,H)),0); B1:=If(A1=1,Highest(ValueWhen(1,A1=1,H)),0); If(Max(B4,Max(B3,Max(B2,B1)))-C>0,Neg(Max(B4,Max(B3,Max(B2,B1)))-C),0); *****re corrected formula***** A4:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=4),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=4),1,0)); A3:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=3),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=3),1,0)); A2:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=2),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=2),1,0)); A1:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=1),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=1),1,0)); B4:=If(A4=1,Highest(ValueWhen(1,A4=1,H)),0); B3:=If(A3=1,Highest(ValueWhen(1,A3=1,H)),0); B2:=If(A2=1,Highest(ValueWhen(1,A2=1,H)),0); B1:=If(A1=1,Highest(ValueWhen(1,A1=1,H)),0); If(Max(B4,Max(B3,Max(B2,B1)))-C>0,Neg(Max(B4,Max(B3,Max(B2,B1)))-C),0);