Function: HisVol
INPUTS: LOOKBCK(NumericSimple), ANNUAL(NumericSimple);
Vars: HVol(0), Per(0);
If DataCompression<=2 then Per=1;
If DataCompression=3 then Per=7;
HVol=StdDev(LOG(Close/Close[1]),LOOKBCK)*SquareRoot(ANNUAL/Per);
HisVol= HVol*100;
System: His.Vol w/ Patterns
Vars: HVRatio(0), NR4(False), InBar(False);
HVRatio=(HisVol(6,365)/HisVol(100,365))*100;
NR4=Range=Lowest(Range,4);
InBar=H<H[1] and L>L[1];
If HVRatio <= 50 and (NR4 or InBar) then begin
Buy at High + (1*MinMove points) stop;
Sell at Low — (1*MinMove points) stop;
end;