{
 "metadata": {
  "name": "",
  "signature": "sha256:f28c6e469ef34ccb2dba85743892d7b8ed37aa95bbbbf261be1078ef431b6422"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from bokeh.plotting import *\n",
      "import numpy as np"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "output_notebook()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Define Bollinger Bands.\n",
      "upperband = np.random.random_integers(100, 150, size=100)\n",
      "lowerband = upperband - 100\n",
      "x_data = np.arange(1, 101)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Bollinger shading glyph:\n",
      "band_x = np.append(x_data, x_data[::-1]) \n",
      "band_y = np.append(lowerband, upperband[::-1])  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "figure(x_axis_type='datetime', tools='pan,wheel_zoom,box_zoom,previewsave,reset,resize')\n",
      "patch(band_x, band_y, color='#7570B3', fill_alpha=0.2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Define plot parameters.\n",
      "curplot().title = 'Bollinger Bands'\n",
      "curplot().height = 600\n",
      "curplot().width = 800\n",
      "grid().grid_line_alpha = 0.4"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}