[LegacyColorValue = true]; 

{ TSMBollingerBands 
  Copyright 1999, P.J.Kaufman. All rights reserved.

  Returns the width of the Bollinger band as measured from the moving average value.
  To create an upper and lower band, add and subtract this value from a trend value. 

  length = calculation period
  nsd = number of standard deviations }

  inputs:	length(numericsimple), nsd(numeric);
  vars:		period(0), factor(0), returns(0);

  period = length;
  if period = 0 then period = 20;
  factor = nsd;
  if factor = 0 then factor = 2.0;
  returns = close/close[1] - 1;
  TSMBollingerBandsReturns = nsd*stddev(returns,length);