code: def update(t):
      open, high, low, close, average = _create_prices(t)
      color = "green" if open < close else "red"
  
      new_data = dict(
          time=[t],
          open=[open],
          high=[high],
          low=[low],
          close=[close],
          average=[average],
          color=[color],
      )
  
      close = source.data["close"] + [close]
      ma12 = _moving_avg(close[-12:], 12)[0]
      ma26 = _moving_avg(close[-26:], 26)[0]
      ema12 = _ema(close[-12:], 12)[0]
      ema26 = _ema(close[-26:], 26)[0]
  
      if mavg.value == MA12:
          new_data["ma"] = [ma12]
      elif mavg.value == MA26:
          new_data["ma"] = [ma26]
      elif mavg.value == EMA12:
          new_data["ma"] = [ema12]
      elif mavg.value == EMA26:
          new_data["ma"] = [ema26]
  
      macd = ema12 - ema26
      new_data["macd"] = [macd]
  
      macd_series = source.data["macd"] + [macd]
      macd9 = _ema(macd_series[-26:], 9)[0]
      new_data["macd9"] = [macd9]
      new_data["macdh"] = [macd - macd9]
  
      source.stream(new_data, 300)
  
file_path: bokeh/examples/server/app/ohlc/main.py
imports: import numpy
  from bokeh.driving import count
  from bokeh.layouts import column, gridplot, row
  from bokeh.models import ColumnDataSource, Select, Slider
  from bokeh.plotting import curdoc, figure
label_desc: Use image node_id 4 for calling a global function with example usage: update(t) without return types