Skip to content
Browse files

Fixed firefox mouse moves

Added Parabolic SAR to indicators
Added test harness html
  • Loading branch information...
1 parent 4514a39 commit d9bff842fd91d9f9cd7bee99739a8dadb4618f90 @chasebgale committed Oct 25, 2011
Showing with 430 additions and 5 deletions.
  1. +2 −2 README
  2. +260 −0 index.html
  3. +168 −3 rocketcharts.js
View
4 README
@@ -1,6 +1,6 @@
* .--.
/ / ` Rocketcharts (http://www.rocketcharts.com)
- + | | Licensed under GPLv3 (http://www.opensource.org/licenses/gpl-3.0.html)
+ + | | Licensed under GPLv3 (http://www.opensource.org/licenses/gpl-3.0.html)
' \ \__, Authored by Chase Gale (http://blog.chasegale.com)
* + '--' *
+ /\
@@ -16,4 +16,4 @@
|/ /||\ \|
jgs _..--"""````"""--.._
_.-'`` ``'-._
- -' '-
+ -' '-
View
260 index.html
@@ -0,0 +1,260 @@
+<html>
+<head>
+<script type="text/javascript" src="rocketcharts.js"></script>
+<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
+<script type="text/javascript" src="http://www.rocketcharts.com/js/date.format.js"></script>
+<script type="text/javascript">
+ $(document).ready(function () {
+
+ var style = new Object();
+ style.UpColor = {r: 0, g: 255, b: 0};
+ style.DownColor = {r: 255, g: 0, b: 0};
+
+ var settings = new Object();
+ settings.customUI = true;
+
+ rocketcharts.init(document.getElementById("rocketchart"), settings);
+
+ var googData = [{date: "11/9/2010",open: 17.22,high: 17.6,low: 16.86,close: 16.97,volume: 56218900},
+{date: "11/10/2010",open: 17,high: 17.01,low: 16.75,close: 16.94,volume: 17012600},
+{date: "11/11/2010",open: 16.63,high: 16.86,low: 16.52,close: 16.8,volume: 15310600},
+{date: "11/12/2010",open: 16.65,high: 16.75,low: 16.4,close: 16.55,volume: 17703400},
+{date: "11/15/2010",open: 16.56,high: 16.89,low: 16.33,close: 16.6,volume: 18934600},
+{date: "11/16/2010",open: 16.45,high: 16.49,low: 16.1,close: 16.24,volume: 23484100},
+{date: "11/17/2010",open: 16.21,high: 16.33,low: 16.11,close: 16.15,volume: 10305800},
+{date: "11/18/2010",open: 16.4,high: 17.17,low: 16.29,close: 16.99,volume: 46500100},
+{date: "11/19/2010",open: 16.97,high: 16.97,low: 16.52,close: 16.57,volume: 24036200},
+{date: "11/22/2010",open: 16.43,high: 16.65,low: 16.25,close: 16.56,volume: 14316900},
+{date: "11/23/2010",open: 16.34,high: 16.43,low: 16.04,close: 16.19,volume: 22437900},
+{date: "11/24/2010",open: 16.31,high: 16.48,low: 16.15,close: 16.41,volume: 11561700},
+{date: "11/26/2010",open: 16.25,high: 16.4,low: 16.22,close: 16.22,volume: 4953900},
+{date: "11/29/2010",open: 16.1,high: 16.45,low: 15.95,close: 16.38,volume: 14653000},
+{date: "11/30/2010",open: 16.2,high: 16.34,low: 15.77,close: 15.82,volume: 24981100},
+{date: "12/1/2010",open: 16,high: 16.4,low: 16,close: 16.15,volume: 17435900},
+{date: "12/2/2010",open: 16.2,high: 16.41,low: 16.12,close: 16.33,volume: 13167300},
+{date: "12/3/2010",open: 16.27,high: 16.37,low: 16.2,close: 16.35,volume: 9228000},
+{date: "12/6/2010",open: 16.47,high: 16.6,low: 16.3,close: 16.33,volume: 12063800},
+{date: "12/7/2010",open: 16.5,high: 17.07,low: 16.5,close: 16.94,volume: 29056400},
+{date: "12/8/2010",open: 17.01,high: 17.22,low: 16.96,close: 17.02,volume: 21773300},
+{date: "12/9/2010",open: 17.12,high: 17.19,low: 16.8,close: 16.95,volume: 8673300},
+{date: "12/10/2010",open: 16.97,high: 17.05,low: 16.91,close: 17.01,volume: 8985300},
+{date: "12/13/2010",open: 16.9,high: 16.99,low: 16.69,close: 16.7,volume: 12755400},
+{date: "12/14/2010",open: 16.77,high: 16.84,low: 16.57,close: 16.63,volume: 11429500},
+{date: "12/15/2010",open: 16.55,high: 16.73,low: 16.42,close: 16.45,volume: 10944200},
+{date: "12/16/2010",open: 16.45,high: 16.7,low: 16.44,close: 16.51,volume: 12940500},
+{date: "12/17/2010",open: 16.51,high: 16.66,low: 16.32,close: 16.38,volume: 24896100},
+{date: "12/20/2010",open: 16.38,high: 16.42,low: 16.15,close: 16.28,volume: 17566400},
+{date: "12/21/2010",open: 16.31,high: 16.68,low: 16.2,close: 16.6,volume: 11394700},
+{date: "12/22/2010",open: 16.67,high: 16.78,low: 16.56,close: 16.63,volume: 6767500},
+{date: "12/23/2010",open: 16.56,high: 16.73,low: 16.45,close: 16.72,volume: 8889200},
+{date: "12/27/2010",open: 16.62,high: 16.63,low: 16.4,close: 16.48,volume: 7492300},
+{date: "12/28/2010",open: 16.47,high: 16.54,low: 16.33,close: 16.43,volume: 8389100},
+{date: "12/29/2010",open: 16.5,high: 16.77,low: 16.43,close: 16.61,volume: 7668600},
+{date: "12/30/2010",open: 16.6,high: 16.77,low: 16.52,close: 16.76,volume: 8318900},
+{date: "12/31/2010",open: 16.74,high: 16.76,low: 16.47,close: 16.63,volume: 7754500},
+{date: "1/3/2011",open: 16.81,high: 16.94,low: 16.67,close: 16.75,volume: 17684000},
+{date: "1/4/2011",open: 16.71,high: 16.83,low: 16.57,close: 16.59,volume: 11092800},
+{date: "1/5/2011",open: 16.55,high: 16.91,low: 16.34,close: 16.91,volume: 23447700},
+{date: "1/6/2011",open: 16.9,high: 17.34,low: 16.77,close: 17.06,volume: 30656800},
+{date: "1/7/2011",open: 17.03,high: 17.17,low: 16.65,close: 16.9,volume: 19869500},
+{date: "1/10/2011",open: 16.78,high: 16.8,low: 16.5,close: 16.6,volume: 16176700},
+{date: "1/11/2011",open: 16.7,high: 16.73,low: 16.53,close: 16.58,volume: 14615700},
+{date: "1/12/2011",open: 16.71,high: 16.81,low: 16.59,close: 16.65,volume: 15066200},
+{date: "1/13/2011",open: 16.64,high: 16.92,low: 16.57,close: 16.75,volume: 15961000},
+{date: "1/14/2011",open: 16.67,high: 16.83,low: 16.6,close: 16.81,volume: 13593500},
+{date: "1/18/2011",open: 16.62,high: 16.68,low: 16.42,close: 16.5,volume: 21392500},
+{date: "1/19/2011",open: 16.49,high: 16.55,low: 16.23,close: 16.31,volume: 17130000},
+{date: "1/20/2011",open: 16.29,high: 16.33,low: 16.09,close: 16.23,volume: 14622700},
+{date: "1/21/2011",open: 16.27,high: 16.31,low: 15.93,close: 15.97,volume: 23366200},
+{date: "1/24/2011",open: 16,high: 16.24,low: 15.76,close: 16.09,volume: 23375300},
+{date: "1/25/2011",open: 16.17,high: 16.19,low: 15.85,close: 16.02,volume: 26673100},
+{date: "1/26/2011",open: 15.93,high: 16.05,low: 15.41,close: 15.57,volume: 49690800},
+{date: "1/27/2011",open: 15.58,high: 16.36,low: 15.58,close: 16.2,volume: 39067000},
+{date: "1/28/2011",open: 16.15,high: 16.21,low: 15.68,close: 15.83,volume: 24734000},
+{date: "1/31/2011",open: 15.82,high: 16.2,low: 15.79,close: 16.12,volume: 22911400},
+{date: "2/1/2011",open: 16.33,high: 16.46,low: 16.23,close: 16.38,volume: 26938900},
+{date: "2/2/2011",open: 16.25,high: 16.66,low: 16.25,close: 16.57,volume: 21106800},
+{date: "2/3/2011",open: 16.48,high: 16.91,low: 16.4,close: 16.69,volume: 33314600},
+{date: "2/4/2011",open: 16.74,high: 16.91,low: 16.45,close: 16.79,volume: 19127900},
+{date: "2/7/2011",open: 16.81,high: 17,low: 16.77,close: 16.8,volume: 16046500},
+{date: "2/8/2011",open: 16.83,high: 16.85,low: 16.48,close: 16.6,volume: 17932000},
+{date: "2/9/2011",open: 16.54,high: 16.7,low: 16.35,close: 16.43,volume: 17778700},
+{date: "2/10/2011",open: 16.39,high: 16.72,low: 16.35,close: 16.62,volume: 15430500},
+{date: "2/11/2011",open: 16.58,high: 16.87,low: 16.54,close: 16.85,volume: 15386300},
+{date: "2/14/2011",open: 16.84,high: 16.93,low: 16.72,close: 16.89,volume: 14503000},
+{date: "2/15/2011",open: 16.8,high: 17.39,low: 16.78,close: 17.2,volume: 31395200},
+{date: "2/16/2011",open: 17.23,high: 17.82,low: 17.21,close: 17.76,volume: 41824100},
+{date: "2/17/2011",open: 17.75,high: 17.82,low: 17.5,close: 17.77,volume: 23566600},
+{date: "2/18/2011",open: 17.69,high: 17.84,low: 17.57,close: 17.66,volume: 13729900},
+{date: "2/22/2011",open: 17.08,high: 17.39,low: 16.87,close: 16.91,volume: 34759500},
+{date: "2/23/2011",open: 17.03,high: 17.1,low: 16.35,close: 16.58,volume: 35225100},
+{date: "2/24/2011",open: 16.66,high: 16.73,low: 16.04,close: 16.37,volume: 31570400},
+{date: "2/25/2011",open: 16.39,high: 16.77,low: 16.38,close: 16.5,volume: 16939600},
+{date: "2/28/2011",open: 16.37,high: 16.6,low: 16.28,close: 16.4,volume: 20210300},
+{date: "3/1/2011",open: 16.46,high: 16.49,low: 16.08,close: 16.1,volume: 16702800},
+{date: "3/2/2011",open: 16.65,high: 16.85,low: 16.6,close: 16.63,volume: 24521100},
+{date: "3/3/2011",open: 16.85,high: 17.05,low: 16.76,close: 16.86,volume: 35202100},
+{date: "3/4/2011",open: 16.75,high: 17.2,low: 16.72,close: 17.08,volume: 20274200},
+{date: "3/7/2011",open: 17.07,high: 17.15,low: 16.49,close: 16.7,volume: 18770800},
+{date: "3/8/2011",open: 16.74,high: 17.02,low: 16.72,close: 16.94,volume: 12717200},
+{date: "3/9/2011",open: 16.89,high: 17.7,low: 16.85,close: 17.65,volume: 33798000},
+{date: "3/10/2011",open: 17.3,high: 17.39,low: 16.93,close: 17.06,volume: 25659700},
+{date: "3/11/2011",open: 17,high: 17.54,low: 17,close: 17.42,volume: 19454900},
+{date: "3/14/2011",open: 17.24,high: 17.44,low: 17.09,close: 17.31,volume: 21615500},
+{date: "3/15/2011",open: 16.66,high: 16.68,low: 16.04,close: 16.33,volume: 51489300},
+{date: "3/16/2011",open: 16.33,high: 16.48,low: 15.85,close: 15.91,volume: 38378500},
+{date: "3/17/2011",open: 16.16,high: 16.42,low: 15.81,close: 15.86,volume: 37548800},
+{date: "3/18/2011",open: 16.1,high: 16.19,low: 16.01,close: 16.03,volume: 26660400},
+{date: "3/21/2011",open: 16.18,high: 16.5,low: 16.16,close: 16.29,volume: 20613700},
+{date: "3/22/2011",open: 16.29,high: 16.48,low: 16.16,close: 16.36,volume: 30692400},
+{date: "3/23/2011",open: 16.3,high: 16.34,low: 15.98,close: 16.13,volume: 30842500},
+{date: "3/24/2011",open: 16.19,high: 16.91,low: 16.17,close: 16.83,volume: 20120300},
+{date: "3/25/2011",open: 16.94,high: 17.05,low: 16.7,close: 16.96,volume: 21047200},
+{date: "3/28/2011",open: 17.01,high: 17.06,low: 16.58,close: 16.58,volume: 16066700},
+{date: "3/29/2011",open: 16.6,high: 16.78,low: 16.53,close: 16.75,volume: 10037900},
+{date: "3/30/2011",open: 16.83,high: 16.92,low: 16.68,close: 16.74,volume: 12944600},
+{date: "3/31/2011",open: 16.71,high: 16.88,low: 16.65,close: 16.68,volume: 15131500},
+{date: "4/1/2011",open: 16.83,high: 16.98,low: 16.72,close: 16.84,volume: 12487400},
+{date: "4/4/2011",open: 16.9,high: 17.05,low: 16.81,close: 16.87,volume: 9560800},
+{date: "4/5/2011",open: 16.81,high: 17.29,low: 16.79,close: 17.11,volume: 18464500},
+{date: "4/6/2011",open: 17.17,high: 17.2,low: 16.94,close: 17.05,volume: 13298700},
+{date: "4/7/2011",open: 16.91,high: 17.1,low: 16.79,close: 17,volume: 12778700},
+{date: "4/8/2011",open: 17.08,high: 17.11,low: 16.77,close: 16.77,volume: 13114200},
+{date: "4/11/2011",open: 16.91,high: 16.96,low: 16.37,close: 16.59,volume: 34841900},
+{date: "4/12/2011",open: 16.55,high: 16.64,low: 16.29,close: 16.36,volume: 19783600},
+{date: "4/13/2011",open: 16.43,high: 16.69,low: 16.43,close: 16.64,volume: 16700400},
+{date: "4/14/2011",open: 16.55,high: 16.82,low: 16.43,close: 16.69,volume: 16595500},
+{date: "4/15/2011",open: 16.64,high: 16.78,low: 16.54,close: 16.62,volume: 14756500},
+{date: "4/18/2011",open: 16.35,high: 16.44,low: 16.06,close: 16.35,volume: 21935700},
+{date: "4/19/2011",open: 16.21,high: 16.36,low: 16.08,close: 16.12,volume: 31547400},
+{date: "4/20/2011",open: 16.7,high: 17.23,low: 16.59,close: 16.87,volume: 34310400},
+{date: "4/21/2011",open: 16.93,high: 16.94,low: 16.74,close: 16.85,volume: 13985200},
+{date: "4/25/2011",open: 17.01,high: 17.31,low: 16.9,close: 17.11,volume: 17771500},
+{date: "4/26/2011",open: 17.11,high: 17.37,low: 17.02,close: 17.28,volume: 20062300},
+{date: "4/27/2011",open: 17.3,high: 17.43,low: 17.18,close: 17.26,volume: 16659400},
+{date: "4/28/2011",open: 17.22,high: 17.53,low: 17.17,close: 17.51,volume: 14414700},
+{date: "4/29/2011",open: 17.46,high: 17.77,low: 17.36,close: 17.7,volume: 30800000},
+{date: "5/2/2011",open: 17.79,high: 18.35,low: 17.57,close: 18.14,volume: 44030600},
+{date: "5/3/2011",open: 18.23,high: 18.64,low: 17.88,close: 17.92,volume: 32622700},
+{date: "5/4/2011",open: 17.99,high: 18.38,low: 17.96,close: 18.2,volume: 23584900},
+{date: "5/5/2011",open: 18.12,high: 18.56,low: 18.05,close: 18.43,volume: 30788400},
+{date: "5/6/2011",open: 18.59,high: 18.8,low: 18.38,close: 18.65,volume: 29690800},
+{date: "5/9/2011",open: 18.6,high: 18.84,low: 18.54,close: 18.56,volume: 15595600},
+{date: "5/10/2011",open: 18.67,high: 18.7,low: 18.42,close: 18.55,volume: 18507100},
+{date: "5/11/2011",open: 18.45,high: 18.61,low: 16.74,close: 17.2,volume: 131183400},
+{date: "5/12/2011",open: 17.12,high: 17.81,low: 16.93,close: 17.17,volume: 52300000},
+{date: "5/13/2011",open: 16.14,high: 16.84,low: 15.96,close: 16.55,volume: 120036300},
+{date: "5/16/2011",open: 16.68,high: 16.69,low: 15.63,close: 15.81,volume: 62082200},
+{date: "5/17/2011",open: 15.88,high: 16.07,low: 15.73,close: 16,volume: 31205200},
+{date: "5/18/2011",open: 16.07,high: 16.16,low: 15.75,close: 15.96,volume: 25649600},
+{date: "5/19/2011",open: 16.05,high: 16.49,low: 16.04,close: 16.35,volume: 40356400},
+{date: "5/20/2011",open: 16.32,high: 16.44,low: 16.15,close: 16.3,volume: 23492200},
+{date: "5/23/2011",open: 16.05,high: 16.17,low: 16,close: 16.06,volume: 19250500},
+{date: "5/24/2011",open: 16.11,high: 16.41,low: 16.05,close: 16.14,volume: 23150600},
+{date: "5/25/2011",open: 16.19,high: 16.99,low: 16.1,close: 16.15,volume: 34166900},
+{date: "5/26/2011",open: 16.18,high: 16.22,low: 15.88,close: 15.98,volume: 23999500},
+{date: "5/27/2011",open: 16.03,high: 16.19,low: 15.95,close: 16.02,volume: 20091200},
+{date: "5/31/2011",open: 16.17,high: 16.59,low: 16.12,close: 16.55,volume: 30248700},
+{date: "6/1/2011",open: 16.34,high: 16.43,low: 15.79,close: 15.85,volume: 40282000},
+{date: "6/2/2011",open: 16,high: 16.11,low: 15.87,close: 16.02,volume: 21005000},
+{date: "6/3/2011",open: 15.82,high: 16,low: 15.63,close: 15.68,volume: 22230500},
+{date: "6/6/2011",open: 15.65,high: 15.85,low: 15.41,close: 15.45,volume: 18200400},
+{date: "6/7/2011",open: 15.54,high: 15.65,low: 15.32,close: 15.45,volume: 16516100},
+{date: "6/8/2011",open: 15.37,high: 15.38,low: 15.08,close: 15.1,volume: 21986600},
+{date: "6/9/2011",open: 15.18,high: 15.33,low: 14.94,close: 15.22,volume: 18681900},
+{date: "6/10/2011",open: 15.27,high: 15.73,low: 15.11,close: 15.2,volume: 19452400},
+{date: "6/13/2011",open: 15.2,high: 15.34,low: 15.1,close: 15.16,volume: 14581200},
+{date: "6/14/2011",open: 15.26,high: 15.56,low: 15.19,close: 15.2,volume: 21994400},
+{date: "6/15/2011",open: 15.01,high: 15.05,low: 14.5,close: 14.81,volume: 41286100},
+{date: "6/16/2011",open: 15.01,high: 15.09,low: 14.65,close: 14.78,volume: 24446700},
+{date: "6/17/2011",open: 14.98,high: 14.98,low: 14.56,close: 14.7,volume: 22963400},
+{date: "6/20/2011",open: 14.66,high: 15.42,low: 14.66,close: 14.99,volume: 32646500},
+{date: "6/21/2011",open: 15.03,high: 15.38,low: 14.91,close: 15.35,volume: 17507800},
+{date: "6/22/2011",open: 15.29,high: 15.53,low: 15.19,close: 15.23,volume: 30081100},
+{date: "6/23/2011",open: 15.08,high: 15.09,low: 14.72,close: 15.08,volume: 32494700},
+{date: "6/24/2011",open: 15.08,high: 15.16,low: 14.85,close: 14.89,volume: 25340600},
+{date: "6/27/2011",open: 14.87,high: 14.98,low: 14.77,close: 14.88,volume: 13836300},
+{date: "6/28/2011",open: 14.95,high: 15.18,low: 14.88,close: 14.95,volume: 16056600},
+{date: "6/29/2011",open: 14.96,high: 15.05,low: 14.68,close: 14.89,volume: 25465200},
+{date: "6/30/2011",open: 14.98,high: 15.1,low: 14.64,close: 15.04,volume: 34905700},
+{date: "7/1/2011",open: 15.08,high: 15.5,low: 15.02,close: 15.45,volume: 16272500},
+{date: "7/5/2011",open: 15.4,high: 15.67,low: 15.25,close: 15.49,volume: 20481700},
+{date: "7/6/2011",open: 15.53,high: 15.81,low: 15.52,close: 15.72,volume: 18287200},
+{date: "7/7/2011",open: 15.78,high: 15.95,low: 15.7,close: 15.81,volume: 20991400},
+{date: "7/8/2011",open: 15.62,high: 15.69,low: 15.44,close: 15.61,volume: 14364900},
+{date: "7/11/2011",open: 15.43,high: 15.44,low: 14.99,close: 15.05,volume: 21486700},
+{date: "7/12/2011",open: 15.01,high: 15.18,low: 14.85,close: 14.86,volume: 22791100},
+{date: "7/13/2011",open: 15.01,high: 15.1,low: 14.87,close: 14.91,volume: 16646100},
+{date: "7/14/2011",open: 14.88,high: 14.99,low: 14.6,close: 14.63,volume: 27078600},
+{date: "7/15/2011",open: 14.75,high: 14.94,low: 14.61,close: 14.69,volume: 19745100},
+{date: "7/18/2011",open: 14.68,high: 14.69,low: 14.37,close: 14.42,volume: 24493400},
+{date: "7/19/2011",open: 14.57,high: 14.69,low: 14.45,close: 14.59,volume: 30132600},
+{date: "7/20/2011",open: 14.15,high: 14.15,low: 13.45,close: 13.48,volume: 63065600},
+{date: "7/21/2011",open: 13.5,high: 13.63,low: 13.36,close: 13.59,volume: 30487100},
+{date: "7/22/2011",open: 13.65,high: 14.05,low: 13.57,close: 13.98,volume: 30144800},
+{date: "7/25/2011",open: 13.84,high: 13.88,low: 13.68,close: 13.69,volume: 16725400},
+{date: "7/26/2011",open: 13.7,high: 13.99,low: 13.65,close: 13.94,volume: 20934200},
+{date: "7/27/2011",open: 13.87,high: 13.9,low: 13.57,close: 13.59,volume: 20559500},
+{date: "7/28/2011",open: 13.6,high: 13.71,low: 13.43,close: 13.5,volume: 20621700},
+{date: "7/29/2011",open: 13.89,high: 14.07,low: 13.04,close: 13.1,volume: 67673900},
+{date: "8/1/2011",open: 13.24,high: 13.34,low: 12.95,close: 13.1,volume: 26859400},
+{date: "8/2/2011",open: 12.96,high: 13.18,low: 12.75,close: 12.76,volume: 25656100},
+{date: "8/3/2011",open: 12.77,high: 13.07,low: 12.53,close: 13.02,volume: 26161900},
+{date: "8/4/2011",open: 12.8,high: 12.86,low: 11.99,close: 12,volume: 39428900},
+{date: "8/5/2011",open: 12.08,high: 12.12,low: 11.41,close: 11.74,volume: 47066200},
+{date: "8/8/2011",open: 11.43,high: 11.8,low: 11.09,close: 11.09,volume: 59560200},
+{date: "8/9/2011",open: 11.3,high: 12.09,low: 11.25,close: 12.09,volume: 47484100},
+{date: "8/10/2011",open: 11.77,high: 12.14,low: 11.62,close: 11.77,volume: 48027400},
+{date: "8/11/2011",open: 11.89,high: 12.92,low: 11.88,close: 12.86,volume: 51098800},
+{date: "8/12/2011",open: 12.81,high: 13.62,low: 12.76,close: 13.59,volume: 48472500},
+{date: "8/15/2011",open: 13.63,high: 13.69,low: 13.27,close: 13.47,volume: 25682800},
+{date: "8/16/2011",open: 13.34,high: 13.57,low: 13.18,close: 13.48,volume: 25581900},
+{date: "8/17/2011",open: 13.49,high: 13.62,low: 13.32,close: 13.47,volume: 17006500},
+{date: "8/18/2011",open: 13.02,high: 13.09,low: 12.8,close: 12.96,volume: 30447700},
+{date: "8/19/2011",open: 12.75,high: 13.08,low: 12.72,close: 12.92,volume: 26183900},
+{date: "8/22/2011",open: 13.16,high: 13.23,low: 12.77,close: 12.84,volume: 14199400},
+{date: "8/23/2011",open: 12.91,high: 13.35,low: 12.75,close: 13.35,volume: 17186500},
+{date: "8/24/2011",open: 13.28,high: 13.3,low: 12.79,close: 13.15,volume: 24967200},
+{date: "8/25/2011",open: 13.12,high: 13.21,low: 12.81,close: 12.87,volume: 21796100},
+{date: "8/26/2011",open: 12.8,high: 12.89,low: 12.52,close: 12.74,volume: 35882600},
+{date: "8/29/2011",open: 12.9,high: 13.68,low: 12.69,close: 13.68,volume: 30990800},
+{date: "8/30/2011",open: 13.3,high: 13.98,low: 13.23,close: 13.84,volume: 29162300},
+{date: "8/31/2011",open: 13.91,high: 13.94,low: 13.54,close: 13.61,volume: 25390700},
+{date: "9/1/2011",open: 13.67,high: 13.78,low: 13.32,close: 13.35,volume: 17847800},
+{date: "9/2/2011",open: 13.12,high: 13.13,low: 12.86,close: 12.87,volume: 20508600},
+{date: "9/6/2011",open: 12.52,high: 12.95,low: 12.45,close: 12.91,volume: 54297300},
+{date: "9/7/2011",open: 13.75,high: 14,low: 13.24,close: 13.61,volume: 77324200},
+{date: "9/8/2011",open: 13.57,high: 14.49,low: 13.37,close: 14.44,volume: 93945500},
+{date: "9/9/2011",open: 14.36,high: 14.57,low: 14.07,close: 14.48,volume: 60009600},
+{date: "9/12/2011",open: 14.12,high: 14.28,low: 13.92,close: 14.26,volume: 32692700},
+{date: "9/13/2011",open: 14.3,high: 14.34,low: 14.12,close: 14.26,volume: 19928800},
+{date: "9/14/2011",open: 14.47,high: 14.94,low: 14.34,close: 14.55,volume: 37385000},
+{date: "9/15/2011",open: 14.73,high: 15.4,low: 14.51,close: 14.89,volume: 58548900},
+{date: "9/16/2011",open: 15.09,high: 15.34,low: 14.94,close: 14.97,volume: 56810800},
+{date: "9/19/2011",open: 14.76,high: 14.79,low: 14.4,close: 14.61,volume: 27249700},
+{date: "9/20/2011",open: 14.53,high: 14.66,low: 14.28,close: 14.36,volume: 21767200},
+{date: "9/21/2011",open: 14.38,high: 14.6,low: 13.96,close: 13.96,volume: 32012800},
+{date: "9/22/2011",open: 14.2,high: 14.25,low: 13.69,close: 13.99,volume: 60439700},
+{date: "9/23/2011",open: 14.23,high: 14.83,low: 14.12,close: 14.71,volume: 49322600},
+{date: "9/26/2011",open: 14.79,high: 14.8,low: 14.23,close: 14.75,volume: 24466200},
+{date: "9/27/2011",open: 14.92,high: 15,low: 14.44,close: 14.54,volume: 25084400},
+{date: "9/28/2011",open: 14.61,high: 14.62,low: 14.15,close: 14.19,volume: 21271900},
+{date: "9/29/2011",open: 14.34,high: 14.39,low: 13.15,close: 13.42,volume: 45776600},
+{date: "9/30/2011",open: 13.21,high: 13.44,low: 13.11,close: 13.17,volume: 30232800}];
+
+// rocketcharts.addSeries(title, data, type, style, panel);
+rocketcharts.addSeries("GOOG", googData, undefined, style);
+// rocketcharts.addIndicator(id, params, series, panel);
+rocketcharts.addIndicator("parabolicsar", undefined, 0, 0);
+});
+// ]]>
+</script>
+</head>
+
+<body>
+
+<div id="rocketchart" style="background-color: #000000; height: 90%; width: 75%; margin: 0 auto;"></div>
+<br />
+<br />
+</body>
+</html>
View
171 rocketcharts.js
@@ -10,7 +10,8 @@ function rocketchart() {
this.element;
this.indicators = [{name: 'Simple Moving Average', id: 'simplemovingaverage'},
{name: 'Weighted Moving Average', id: 'weightedmovingaverage'},
- {name: 'Moving Average Convergance/Divergance', id: 'movingaverageconvergancedivergance'}]
+ {name: 'Moving Average Convergance/Divergance', id: 'movingaverageconvergancedivergance'},
+ {name: 'Parabolic SAR', id: 'parabolicsar'}]
this.priceAxisWidth = 75;
@@ -68,11 +69,19 @@ rocketchart.prototype.init = function(element, settings){
});
this.element.bind("mousedown", function(event, ui) {
$(this).bind( "mousemove", function(event, ui) {
- rocketcharts.headsUpDisplay(event.offsetX, event.offsetY);
+
+ var relativeX = event.pageX - this.offsetLeft;
+ var relativeY = event.pageY - this.offsetTop;
+
+ rocketcharts.headsUpDisplay(relativeX, relativeY);
rocketcharts.draw();
});
this.style.cursor = 'crosshair';
- rocketcharts.headsUpDisplay(event.offsetX, event.offsetY);
+
+ var relativeX = event.pageX - this.offsetLeft;
+ var relativeY = event.pageY - this.offsetTop;
+
+ rocketcharts.headsUpDisplay(relativeX, relativeY);
rocketcharts.draw();
return false; // Prevents browser from changing cursor to 'I-Beam', thinking we are trying to select text
});
@@ -804,6 +813,9 @@ rocketindicator.prototype.draw = function(imageData, verticalPixelPerPoint, grid
case rocketseries.seriesType.HISTOGRAM:
this.drawHistogram(imageData, verticalPixelPerPoint, gridMin, w, h, i);
break;
+ case rocketseries.seriesType.DOT:
+ this.drawDot(imageData, verticalPixelPerPoint, gridMin, w, h, i);
+ break;
}
}
}
@@ -859,6 +871,30 @@ rocketindicator.prototype.drawLine = function(imageData, verticalPixelPerPoint,
}
}
+rocketindicator.prototype.drawDot = function(imageData, verticalPixelPerPoint, gridMin, w, h, s){
+ var indicatorData = this._indicator._data;
+ var seriesLength = 0;
+ var lastValue = 0;
+ var lastValueOld = 0;
+ var i = 0;
+ var X = 0;
+ var horizSpacing = w / this._indicator._sourceData.length;
+ var halfhorizSpacing = horizSpacing / 2;
+
+ seriesLength = indicatorData[s].length;
+
+ for (i = 0; i < seriesLength; i++)
+ {
+ if (indicatorData[s][i] != null)
+ {
+ lastValue = h - (verticalPixelPerPoint * (indicatorData[s][i] - gridMin));
+ box(imageData, X - 1, lastValue - 1, X, lastValue, 255, 255, 255, 255);
+ }
+
+ X += horizSpacing;
+ }
+}
+
rocketindicator.prototype.drawHistogram = function(imageData, verticalPixelPerPoint, gridMin, w, h, s){
var indicatorData = this._indicator._data;
var seriesCount = indicatorData.length;
@@ -1174,6 +1210,135 @@ rocketindicatorcalculations.prototype.movingaverageconvergancedivergance = funct
this.calculate();
};
+rocketindicatorcalculations.prototype.parabolicsar = function (data, params, series) {
+ this._params = params;
+ this._series = series;
+ this._sourceData = data;
+ this._data = new Array();
+
+ if (this._series == undefined){
+ this._series = new Array();
+ this._series[0] = {type: rocketseries.seriesType.DOT, title: "SAR", color: 0xFF0000};
+ }
+
+ if (this._params == undefined){
+ // Create default params, will also serve the purpose of declaring the parameters
+ this._params = new Array();
+ this._params[0] = {name: 'Acceleration', type: 'float', value: 0.02};
+ this._params[1] = {name: 'Acceleration Ceiling', type: 'float', value: 0.2};
+ }
+
+ this.calculate = function(){
+ if (this._sourceData != null) {
+
+ var i = 0;
+
+ for (var i = 0; i<this._series.length; i++){
+ this._data[i] = new Array();
+ }
+
+ var RecordCount = this._sourceData.length;
+ var Record = 0;
+ var Period = 0;
+ var Start = 0;
+ var Position = 0;
+
+ var Max = 0;
+ var Min = 0;
+ var pSAR = 0;
+ var pEP = 0;
+ var pAF = 0;
+ var SAR = 0;
+ var AF = 0;
+ var Hi = 0;
+ var Lo = 0;
+ var pHi = 0;
+ var pLo = 0;
+
+ var MinAF = this._params[0].value;
+ var MaxAF = this._params[1].value;
+
+ Start = 2;
+
+ Max = this._sourceData[1]["high"];
+ Min = this._sourceData[1]["low"];
+
+ if ((this._sourceData[2]["high"] - this._sourceData[1]["high"]) < (this._sourceData[2]["low"] - this._sourceData[1]["low"]))
+ {
+ pSAR = Max;
+ Position = -1;
+ }
+ else
+ {
+ pSAR = Min;
+ Position = 1;
+ }
+
+ pAF = MinAF;
+ SAR = pSAR;
+ Hi = Max;
+ Lo = Min;
+ pHi = Hi;
+ pLo = Lo;
+ AF = MinAF;
+
+ for (Record = Start; Record < RecordCount; ++Record)
+ {
+ if (Position == 1)
+ {
+ if (this._sourceData[Record]["high"] > Hi)
+ {
+ Hi = this._sourceData[Record]["high"];
+ if (AF < MaxAF)
+ AF = AF + MinAF;
+ }
+
+ SAR = pSAR + pAF * (pHi - pSAR);
+
+ if (this._sourceData[Record]["low"] < SAR)
+ {
+ Position = -1;
+ AF = MinAF;
+ SAR = pHi;
+ Hi = 0;
+ Lo = this._sourceData[Record]["low"];
+ }
+ }
+ else if (Position == -1)
+ {
+ if (this._sourceData[Record]["low"] < Lo)
+ {
+ Lo = this._sourceData[Record]["low"];
+ if (AF < MaxAF)
+ AF = AF + MinAF;
+ }
+
+ SAR = pSAR + pAF * (pLo - pSAR);
+
+ if (this._sourceData[Record]["high"] > SAR)
+ {
+ Position = 1;
+ AF = MinAF;
+ SAR = pLo;
+ Lo = 0;
+ Hi = this._sourceData[Record]["high"];
+ }
+ }
+
+ pHi = Hi;
+ pLo = Lo;
+ pSAR = SAR;
+ pAF = AF;
+
+ this._data[0][Record] = SAR;
+ }
+
+ }
+ }
+
+ this.calculate();
+};
+
function box(context,x0,y0,x1,y1,r,g,b,a,border){

0 comments on commit d9bff84

Please sign in to comment.
Something went wrong with that request. Please try again.