Hi
Can someone help me in fixing the Error 6 in the below code.
_SECTION_BEGIN(" VIXSRLEVELS");
VIX_SRLines = ParamToggle("GANN 19.1 S&R Levels", "Click to enable|Click to disable", 1);
Ind_VIX_Fac = Param("India VIX Index", 12, 6, 50, 0.5);
SetPrice = Param("Settlement Price", 45900, 45900, 55000, 1);
VIX_SR_Level_Per = Ind_VIX_Fac/19.1 ;
VIX_Sup_Level = SetPrice - (SetPrice/100)*VIX_SR_Level_Per ;
VIX_Res_Level = SetPrice + (SetPrice/100)*VIX_SR_Level_Per ;
VIX_Res_Level = IIf(Ref(VIX_Res_Level, -1) == VIX_Res_Level, VIX_Res_Level, Null);
VIX_Sup_Level = IIf(Ref(VIX_Sup_Level, -1) == VIX_Sup_Level, VIX_Sup_Level, Null);
rangeFac = (VIX_Res_Level - VIX_Sup_Level)/SetPrice*100 ;
GfxTextOut("rangeFac: " + WriteVal(VIX_SR_Level_Per,1.2), 10, 130);
if(rangeFac < 1)
GfxTextOut("Trend: RangeBound", 10, 170);
else if(rangeFac >= 1.5)
GfxTextOut("Trend: Volatile", 10, 170);
else if(rangeFac >=1 AND rangeFac < 1.5)
GfxTextOut("Trend: Trendy", 10, 170);
_SECTION_END( );
VIX_Res_Level represents a computed value for the resistance level, while VIX_Sup_Level represents another computed value for the support level.
I am trying to calculate the range or difference between the two:
Range = VIX_Res_Level - VIX_Sup_Level;
The resulting 'Range' should be a numeric value; however, I am encountering an error that states: 'Error 6: Condition in IF, WHILE, FOR statements must be of Numeric or Boolean type. You cannot use an array here. Please use the (array subscript operator) to access array elements when using that value in the IF condition.
Thank you