title: algorithm of adding "stationarity" to long series of decimal values
body: <p>Assume you want to "keep" your limit order to buy "MSFT" always $0.10 cheaper than current Offer.</p>
  
  <p>So if Offer moves you should move your order as well.</p>
  
  <p>For example if Offer was moved from 30.10 to 30.11, you have to move your order from 30.00 to 30.01</p>
  
  <p>The problem is that if by some reason Offer moves frequently between 30.10 and 30.11 you will also move your order frequently. It's too bad because stock exchange "charges" for extra transactions and so we should keep number of transactions as small as possible.</p>
  
  <p>So I want to make my series more "stationary". I.e. i want to replace such series "30.00 30.01 30.00 30.01 30.00 30.01 30.02" to probably such series "30.00 30.00 30.00 30.00 30.00 30.01 30.02"</p>
  
  <p>I don't know how exactly "Offer" will change, but I need to "limit" number of movements of my order.</p>
  
  <p>So I would suggest to use such simple Solution1: if order moves from Price1 to Price2 then it's prohibited to move this order to Price1 for the next period of time (1 second or something). This will cover all cases. For example:</p>
  
  <ol>
  <li>Price1 -> Price2 - allow</li>
  <li>Price2 -> Price3 - allow</li>
  <li>Price3 -> Price1 - decline if not enough time elapsed</li>
  </ol>
  
  <p>I can also suggest Solution2:</p>
  
  <p>Instead of "current Offer" use "minimal Offer for last period of time". For example "minimal Offer for last second" will not change too often.</p>
  
  <p>In "Solution1" i immediately react on up/down change but filter out "repeated" change. However I will still move "once per period".</p>
  
  <p>In "Solution2" i react with "delay" on up change and immediately react on down change but I will not move at all even sometimes, because every time lowest Offer repeat my "stopwatch" will be "reset" and "tick again for one second". So if "lowest offer" repeat once per second or more I will just stay at some point without any movements.</p>
  
  <p>What do you think what can you suggest?</p>