[LegacyColorValue = true]; 

{ TSMCambridgeHook: Cambridge Hook
  Copyright 1999,2012, P.J.Kaufman. All rights reserved.
}
  inputs: length(numericsimple), vlength(numericsimple);
  vars:   avgv(0), avgoi(0);

  TSMCambridgeHook = 0;
  if vlength < 2 then begin
			avgv = volume;
			avgoi = openint;
			end
     else begin
			avgv = average(volume,vlength);     
			avgoi = average(openint,vlength);
	  end;
 if high > high[1] and close < close[1] and RSI(close,length) > 60 and 
 			avgv > avgv[1] and avgoi > avgoi[1]then TSMCambridgeHook = -1
 	else if low < low[1] and close > close[1] and RSI(close,length) < 40 and
 			avgv > avgv[1] and avgoi > avgoi[1]then TSMCambridgeHook = 1;
