title: kapacitor tickscript won't work after adjustment
body: <p>I adjust tickscript(kapacitor) for my calculation.
  However, no alerts work after few changes.
  Before adjustment, it worked without problem.
  I wonder why it does not work after adjustment.
  To be more specific, I need to get &quot;MACD&quot; of my stock price.
  Measurements contain the price of each items.
  Anyone knows why?</p>
  <p>before it was:</p>
  <pre><code>var db = 'telegraf'
  
  var rp = 'autogen'
  
  var measurement = 'exec'
  
  var groupBy = ['symbol']
  
  var whereFilter = lambda: TRUE
  
  var name = 'coin'
  
  var idVar = name + '-{{.Group}}'
  
  var message = ' {{.ID}} {{.Level}} {{.Time}}'
  
  var idTag = 'alertID'
  
  var levelTag = 'level'
  
  var messageField = 'message'
  
  var durationField = 'duration'
  
  var outputDB = 'chronograf'
  
  var outputRP = 'autogen'
  
  var outputMeasurement = 'alerts'
  
  var triggerType = 'threshold'
  
  var crit = 50000000000
  
  var data = stream
      |from()
          .database(db)
          .retentionPolicy(rp)
          .measurement(measurement)
          .groupBy(groupBy)
          .where(whereFilter)
      |eval(lambda: &quot;lastPrice&quot;)
          .as('value')
  
  var trigger = data
      |alert()
          .crit(lambda: &quot;value&quot; &gt; crit)
          .message(message)
          .id(idVar)
          .idTag(idTag)
          .levelTag(levelTag)
          .messageField(messageField)
          .durationField(durationField)
          .stateChangesOnly()
          .telegram()
          .chatId('####')
          .parseMode('Markdown')
  
  trigger
      |eval(lambda: float(&quot;value&quot;))
          .as('value')
          .keep()
      |influxDBOut()
          .create()
          .database(outputDB)
          .retentionPolicy(outputRP)
          .measurement(outputMeasurement)
          .tag('alertName', name)
          .tag('triggerType', triggerType)
  
  trigger
      |httpOut('output')
  
  </code></pre>
  <p>Now it became:</p>
  <pre><code>var db = 'telegraf'
  
  var rp = 'autogen'
  
  var measurement = 'exec'
  
  var groupBy = ['symbol']
  
  var whereFilter = lambda: TRUE
  
  var name = 'coin'
  
  var idVar = name + '-{{.Group}}'
  
  var message = ' {{.ID}} {{.Level}} {{.Time}}'
  
  var idTag = 'alertID'
  
  var levelTag = 'level'
  
  var messageField = 'message'
  
  var durationField = 'duration'
  
  var outputDB = 'chronograf'
  
  var outputRP = 'autogen'
  
  var outputMeasurement = 'alerts'
  
  var triggerType = 'threshold'
  
  var crit = 0
  
  var data = stream
      |from()
          .database(db)
          .retentionPolicy(rp)
          .measurement(measurement)
          .groupBy(groupBy)
          .where(whereFilter)
      |eval(lambda: &quot;lastPrice&quot;)
          .as('v')
  
  var avg12 = data
      |window()
          .period(3m)
          .every(1m)
      |mean('x1')
          .as('x1a')
  
  var avg26 = data
      |window()
          .period(5m)
          .every(1m)
      |mean('x2')
          .as('x2a')
  
  var macd = avg12
      |join(avg26)
          .as('x1a', 'x2a')
      |eval(lambda: float('x1a.value' - 'x2a.value'))
          .keep()
          .as('value')
  
  var trigger = macd
      |alert()
          .crit(lambda: &quot;value&quot; &gt; crit)
          .message(message)
          .id(idVar)
          .idTag(idTag)
          .levelTag(levelTag)
          .messageField(messageField)
          .durationField(durationField)
          .stateChangesOnly()
          .telegram()
          .chatId('###')
          .parseMode('Markdown')
  
  trigger
      |eval(lambda: float(&quot;value&quot;))
          .as('value')
          .keep()
      |influxDBOut()
          .create()
          .database(outputDB)
          .retentionPolicy(outputRP)
          .measurement(outputMeasurement)
          .tag('alertName', name)
          .tag('triggerType', triggerType)
  
  trigger
      |httpOut('output')
  </code></pre>