( using Version 6.38.0 x64 )
Hello everyone,
I am getting some strange -9.999999e+09 values in my arrays when executing the code below. From values of 0 to 511 for the variable lengthA/lengthB, everything is working fine and I am getting either the value "Null" or the actual bar index numbers of the highs I am trying to find, as a result in the arrays. In the arrays: hhvPeakBarsX1, hhvPeakAvailFromBarsX1, hhvPeakBarsCompX1 and hhvPeakAvailFromBarsCompX1 you can see that everything is fine as it should be, either "Null" or the bar index number of the found highs.
But for values of lengthA > 511 its different, thats why I included a second version of the code with lengthB == 512.
In the arrays: hhvPeakAvailFromBarsX2 and hhvPeakAvailFromBarsCompX2 you can see that I get these strange -9.999999e+09 values instead of "Null" values, please look at the screenshots.
It also happens for other values of lengthA/lengthB > 512 like 513, 514, 515 etc...
These -9.999999e+09 values mess up the neat compressed array hhvPeakAvailFromBarsCompX2 and the not compressed array hhvPeakAvailFromBarsX2 as you can see in the screenshots.
Why does this happen for values of lengthA/lengthB >= 512 and how can I avoid this happening so that I can get my highs compressed at the end of the compressed arrays like for hhvPeakAvailFromBarsX1 and hhvPeakAvailFromBarsCompX1 where lengthA/lengthB is <= 511 ? thanks a lot for your help
In my understanding adding or subtracting any value to or from "Null" value should result in "Null" value again and not in -9-999999e+09.
And If I used 0 instead of "Null" value in hhvPeakBarsX, I cannot shift my arrays the way I do for hhvPeakAvailFromBarsX because adding or subtracting anything from 0 results in a different number than 0.
bi = BarIndex();
a = 1;
lengthA = 511;
VarSet( "hhvPeakBarsX" + a, IIf( Ref( HHVBars( H, ( lengthA * 2 ) + 1 ) == lengthA, lengthA ) && bi >= lengthA, bi, Null ) );
VarSet( "hhvPeakAvailFromBarsX" + a, Ref( VarGet( "hhvPeakBarsX" + a ), - lengthA ) + lengthA );
VarSet( "hhvPeakBarsCompX" + a, SparseCompress( VarGet( "hhvPeakBarsX" + a ), VarGet( "hhvPeakBarsX" + a ) ) );
VarSet( "hhvPeakAvailFromBarsCompX" + a, SparseCompress( VarGet( "hhvPeakAvailFromBarsX" + a ), VarGet( "hhvPeakAvailFromBarsX" + a ) ) );
b = 2;
lengthB = 512;
VarSet( "hhvPeakBarsX" + b, IIf( Ref( HHVBars( H, ( lengthB * 2 ) + 1 ) == lengthB, lengthB ) && bi >= lengthB, bi, Null ) );
VarSet( "hhvPeakAvailFromBarsX" + b, Ref( VarGet( "hhvPeakBarsX" + b ), - lengthB ) + lengthB );
VarSet( "hhvPeakBarsCompX" + b, SparseCompress( VarGet( "hhvPeakBarsX" + b ), VarGet( "hhvPeakBarsX" + b ) ) );
VarSet( "hhvPeakAvailFromBarsCompX" + b, SparseCompress( VarGet( "hhvPeakAvailFromBarsX" + b ), VarGet( "hhvPeakAvailFromBarsX" + b ) ) );