fixed threshold calculation bug
fixed minimum calculation bug in candle calculation
added back array sorting for empty candle addition
Only archive old logfile if it exists.
Merge pull request #99 from yin/localDB

Only archive old logfile if it exists.