Indicators demo

author(s): Black Label

by Anuradha Pai

HTML

<link rel="stylesheet" href="http://blacklabel.github.io/indicators/css/styles.css">
<script src="http://code.highcharts.com/stock/highstock.src.js"></script>
<script src="http://blacklabel.github.io/indicators/js/indicators.js"></script>
<script src="http://blacklabel.github.io/indicators/js/sma.js"></script>
<script src="http://blacklabel.github.io/indicators/js/ema.js"></script>
<script src="http://blacklabel.github.io/indicators/js/atr.js"></script>
<script src="http://blacklabel.github.io/indicators/js/rsi.js"></script>
<div id="container-advanced" style="height:400px" class="chart"></div>
<button id="rsibtn">RemoveRSI</button>
<button id="smabtn">RemoveSMA</button>
<button id="emabtn">RemoveEMA</button>

CSS

body {
    padding: 0px !important;
}

JavaScript

$(function () {

    var adv_options = {
        chart: {
            borderWidth: 5,
            borderColor: '#e8eaeb',
            borderRadius: 0,
            backgroundColor: '#f7f7f7'
        },
        title: {
            style: {
                'fontSize': '1em'
            },
            useHTML: true,
            x: -27,
            y: 8,
            text: '<span class="chart-title">SMA, EMA, ATR, RSI indicators <span class="chart-href"> <a href="http://www.blacklabel.pl/highcharts" target="_blank"> Black Label </a> </span> <span class="chart-subtitle">plugin by </span></span>'
        },
        indicators: [{
            id: 'AAPL',
            type: 'sma',
            params: {
                period: 14
            },
            tooltip: {
            	pointFormat: '<span style="color: {point.color}; ">SMA value: </span> {point.y}<br>'
            }
        }, {
            id: 'AAPL',
            type: 'ema',
            params: {
                period: 14,
                index: 0 //optional parameter for ohlc / candlestick / arearange - index of value
            },
            styles: {
                strokeWidth: 2,
                stroke: 'green',
                dashstyle: 'solid'
            }
        }, {
            id: 'AAPL',
            type: 'atr',
            params: {
                period: 14
            },
            styles: {
                strokeWidth: 2,
                stroke: 'orange',
                dashstyle: 'solid'
            },
            yAxis: {
                lineWidth: 2,
                title: {
                    text: 'ATR'
                }
            }
        }, {
            id: 'AAPL',
            type: 'rsi',
            params: {
                period: 14,
                overbought: 70,
                oversold: 30
            },
            styles: {
                strokeWidth: 2,
                stroke: 'black',
                dashstyle: 'solid'
            },
            yAxis: {
       ...