Type : Function, Name : VIMALength
inputs:
MaxLength1(numericsimple),
{«interval» will vary from 2 days to (MaxLength1 + 1)
days; equivalently, Length1 below will vary from 1 day to MaxLength1 days}
Length2(numericsimple),
{number of historical RESULTS to consider for each max/min calculation;
actual number of historical data points used may be more than this}
ShortestVIMALength(numericsimple),
LongestVIMALength(numericsimple);
variables:
VIMAOsc( 0 ),
Length1( 0 ),
MaxDiff( 0 ),
MinDiff( 0 ),
NormDiff( 0 ),
VIMAOscMax( 0 ),
VIMAOscMin( 0 ),
VIMAOscNorm( 0 ),
VIMALengthRange(LongestVIMALength — ShortestVIMALength);
VIMAOsc = 0;
for Length1 = 1 to MaxLength1
begin
MaxDiff = Highest(Close — Close[Length1], Length2);
MinDiff = Lowest(Close — Close[Length1], Length2);
NormDiff = (Close — Close[Length1] — MinDiff) / (MaxDiff — MinDiff);
VIMAOsc = VIMAOsc + NormDiff;
end;
VIMAOscMax = Highest(VIMAOsc, Length2);
VIMAOscMin = Lowest(VIMAOsc, Length2);
VIMAOscNorm = (VIMAOsc — VIMAOscMin) / (VIMAOscMax — VIMAOscMin);
VIMALength = ShortestVIMALength + Round(VIMAOscNorm * VIMALengthRange, 0);
Type : Indicator, Name : VIMA
inputs:
MaxLength1( 3 ),
Length2( 20 ),
ShortestVIMALength( 3 ),
LongestVIMALength( 6 );
variables:
CurrentVIMALength( 0 );
CurrentVIMALength = VIMALength( MaxLength1, Length2,
ShortestVIMALength, LongestVIMALength);
Plot1(Average(Close, CurrentVIMALength));