-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.html
227 lines (204 loc) · 9.13 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!doctype html>
<html>
<head>
<title>Indicators demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://code.highcharts.com/stock/js/highstock.src.js"></script>
<script type="text/javascript" src="js/indicators.js"></script>
<script type="text/javascript" src="js/sma.js"></script>
<script type="text/javascript" src="js/ema.js"></script>
<script type="text/javascript" src="js/atr.js"></script>
<script type="text/javascript" src="js/rsi.js"></script>
<script type="text/javascript" src="js/demo.js"></script>
<link rel="stylesheet" charset="utf-8" type="text/css" href="./css/styles.css"/>
</head>
<body>
<div id="main-content">
<h1>Indicators - Highstock module</h1>
<p> Indicators available in this plugin: <b>SMA, EMA, ATR, RSI</b>. You can use these indicators for free. </p>
<p> <div class="info"> We also have other indicators available: <b>Bollinger Bands, MACD, Momentum, CCI, Stochastic, Rate of Change (ROC), Accumulation / distribution (AD), Pivot Points, ZigZag, Weighted Moving Average (WMA), PSAR, MFI, Price Envelopes.</b>. <br> If you're are interested in purchasing them, developing new indicators or any other tools, please contact us at: <a href="mailto:start@blacklabel.pl"> start@blacklabel.pl </a>
You may also want to check our other demo here: <a href="http://demo.blacklabel.pl">http://demo.blacklabel.pl</a>.</div> </p>
<div id="chart-advanced" class="chart"></div>
<h3>Requirements</h3>
<ul>
<li>Version <b>2.0+</b> requires the latest Highstock (<b>v2.1.5+</b>)</li>
<li>Version <b>1.1</b> requires Highstock <b>v2.1.5</b></li>
<li>Version <b><1.1</b> supported since Highstock <b>v1.3.9</b> to Highstock <b>v2.1.4</b></li>
</ul>
<h3>Versions</h3>
<ul>
<li><b>2.x</b> - Improved logic for calculations and performance. Values are based on initial points, not grouped. When points are grouped by <code>dataGrouping</code> then indicators values are grouped too.</li>
<li><b>1.x</b> - Initial version of Indicators.js. Calculations are based on grouped points (aka <code>dataGrouping</code>)</li>
</ul>
<h3>Installation</h3>
<ul>
<li>Like any other Highcharts module (e.g. exporting), add <code><script></code> tag pointing to <code>indicators.js</code> below Highcharts script tag. Then attach all required indicators (like <code>ema.js</code>, <code>rsi.js</code>).</li>
<li>
For NPM users:
<pre><code>var Highcharts = require('highcharts/highstock');
require('indicators')(Highcharts);
require('sma')(Highcharts);
require('ema')(Highcharts);
require('rsi')(Highcharts);
require('atr')(Highcharts);
</pre></code>
</li>
</ul>
<h3>Code</h3>
<p>The latest code is available on github: <a href="https://github.com/blacklabel/indicators/">(https://github.com/blacklabel/indicators/)</a></p>
<h3>Usage and demos</h3>
<pre>
indicators: [{
id: 'AAPL',
type: 'sma',
params: {
period: 5,
}
}, {
id: 'AAPL',
type: 'ema',
params: {
period: 5,
index: 0
},
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:'My ATR title'
}
}
}, {
id: 'AAPL',
type: 'rsi',
params: {
period: 14,
overbought: 70,
oversold: 30
},
styles: {
strokeWidth: 2,
stroke: 'black',
dashstyle: 'solid'
},
yAxis: {
lineWidth:2,
title: {
text:'My RSI title'
}
}
}],
tooltip:{
enabledIndicators: true
},
</pre>
<h3>Parameters</h3>
<table>
<thead>
<tr>
<th align="left">Property</th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr><td align="left">id</td><td>String</td><td align="left">id of series</td></tr>
<tr><td align="left">type</td><td>String</td><td align="left">type of indicator (one of: <code>sma</code>, <code>ema</code>, <code>atr</code>, <code>rsi</code>)</td></tr>
<tr><td align="left">showInLegend</td><td>Boolean</td><td align="left">determines if indicator should be visible in the legend. Defaults to <code>false</code>.</td></tr>
<tr><td align="left">name</td><td>String</td><td align="left">name is used in legend and tooltip to display indicator. By default it's the same as type.</td></tr>
<tr><td align="left">styles</td><td>Object</td><td align="left">color, dashstyle, width etc. for a indicator line</td></tr>
<tr><td align="left">yAxis (ATR/RSI)</td><td>Object</td><td align="left">yAxis object like in Highcharts, options for additional yAxis</td></tr>
<tr><td align="left">params</td><td>Object</td><td align="left">config options for indicator</td></tr>
<tr><td align="left">params.approximation (SMA/EMA/ATR/RSI)</td><td>String/Function</td><td align="left">The same property as in <code>dataGrouping.approximation</code> for Highstock. Supported since version <b>2.0.0</b>. Defaults to <code>"average"</code>.</td></tr>
<tr><td align="left">params.period (SMA/EMA/ATR/RSI)</td><td>Number</td><td align="left">base perdiod for indicator (it's number of points to be calculated). Defaults to <code>14</code>.</td></tr>
<tr><td align="left">params.index (SMA/EMA)</td><td>Number</td><td align="left">y-value index. Useful when using candlestick/ohlc/range series to determine which value (open/high/low/close) should be used in indicator. Defaults to <code>0</code>.</td></tr>
<tr><td align="left">params.overbought (RSI)</td><td>Number</td><td align="left">overbought value between 0-100. Defaults to <code>70</code>.</td></tr>
<tr><td align="left">params.oversold (RSI)</td><td>Number</td><td align="left">oversold value between 0-100. Defaults to <code>30</code>.</td></tr>
<tr><td align="left">params.decimals (RSI)</td><td>Number</td><td align="left"> Precision for the calculations. For example decimals=1 will cut off value 123.4567 to 123.4. Higher value provides more accurate values, but will cost performance. Defaults to <code>4</code>.</td></tr>
<tr>
<td align="left">tooltip.pointFormat</td>
<td align="left">String</td>
<td align="left"> <code>point.color</code> and <code>point.y</code> return values from indicator. Disabled by default.</td>
</tr>
</tbody>
</table>
<h3>New options/methods in Chart:</h3>
<table>
<thead>
<tr>
<th align="left"> Method </th>
<th align="left"> Version: </th>
<th align="left"> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"> chart.addIndicator(options, [redraw]) </td>
<td align="left"> v 1.0.0+ </td>
<td align="left"> Add new indicator with given options. Optionally redraw chart.</td>
</tr>
<tr>
<td align="left"> chart.indicators.allItems </td>
<td align="left"> v 1.0.0+ </td>
<td align="left"> Array containing all indicators.</td>
</tr>
<tr>
<td align="left"> chart.alignAxes </td>
<td align="left"> v 1.0.9+ </td>
<td align="left"> <code>true</code>/<code>false</code>. When idicator requires separate yAxis (like ATR or RSI) then indicators plugin will update heights of the axes to fit plotting area. Disable it and set <code>yAxis.top</code> and <code>yAxis.height</code> when you want different heights for the y-axes. Defaults to <code>true</code>. <b>Note:<b> When disabled, top and height options need to be set for all axes for better view.</td>
</tr>
<tr>
<td align="left"> tooltip.enabledIndicators</td>
<td align="left"> v 1.0.0+ </td>
<td align="left"> <code>true</code>/<code>false</code>, show indicators in tooltip. Disabled by default.</td>
</tr>
<tr>
<td align="left"> Highcharts.approximations</td>
<td align="left"> v 2.0.0+ </td>
<td align="left"> Object containing built-in approximations (functions) in Highstock. For more details see <code>dataGrouping.approximation</code></td>
</tr>
</tbody>
</table>
<h3>Indicator object</h3>
<table>
<thead>
<tr>
<th align="left"> Method </th>
<th align="left"> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"> indicator.update(options) </td>
<td align="left"> Update indicator with given options</td>
</tr>
<tr>
<td align="left"> indicator.destroy() </td>
<td align="left"> Destroy indicator</td>
</tr>
<tr>
<td align="left"> indicator.setVisible(true|false) </td>
<td align="left"> Hide or show indicator.</td>
</tr>
</tbody>
</table>
<h3>Demo</h3>
<p>Demos are available at project's github page: <a href="http://blacklabel.github.io/indicators/">(http://blacklabel.github.io/indicators/)</a></p>
</div>
</body>
</html>