           now.position = now.trade
           now.extreme = now.price
           now.sar = now.price
-          now.openPrice = if now.trade then now.price
+          now.openPrice = if now.trade then now.price else 0
       last = now
     console.log last.return
 

(err, data) ->
  if err
    throw err
  raw = JSON.parse(data)[-300..]
  predict raw
  return

          (1 + last.return) *
          (1 - now.trade * (now.openPrice / now.price - 1)) - 1
          now.openPrice = 0
      else if @cutoff < i # Consider opening a position
        if last.max <= now.price
          now.trade = 1
        else if now.price <= last.min
