Wednesday, February 15, 2017

charting functions

function getfinvizlink(symbol) {
var link = '<a href="http://elite.finviz.com/quote.ashx?t=' + symbol + '"'
return link + ' style="font-size:2em;color:burlywood" target="_blank">f</a>'}

function getmarketwatchlink(symbol) {
var link = '<a href="http://www.marketwatch.com/investing/stock/' + symbol + '"'
return link + ' style="font-size:2em;color:burlywood" target="_blank">m</a>'}

function getrecord(url) {
var record = '<a href="' + url + '" target="_blank"

function getrecordset(url) {
var set = '<img src="' + url + '" style="width:200px" />'
set = set + getfinvizlink(symbol(url)) + getmarketwatchlink(symbol(url))
return set + '<img src="' + getupdater(symbol(url)) + '" style="width:200px" />'}

function escape(string) {
var partlyescaped = string.replace(/</g, "&lt;")
return partlyescaped.replace(/>/g, "&gt;")}

function getupdater(symbol) {
var updater = 'http://elite.finviz.com/chart.ashx?t='



<img id="record" src="" style="width:200px" /><img id="updater" src="" style="width:200px" />
<div id="next" style="position:fixed;right:0%;bottom:0%;width:100px;height:50px;background-color:greenyellow" onmouseover="next()"><div style="position:absolute;left:50%;bottom:110%;width:70%;height:50%;background-color:pink;display:none" onmouseover="getnext()"></div></div><div id="previous" style="position:fixed;left:0%;bottom:0%;width:100px;height:50px;background-color:greenyellow" onmouseover="previous()"><div style="position:absolute;left:50%;bottom:110%;width:70%;height:50%;background-color:pink;display:none" onmouseover="getprevious()"></div></div><div style="position:absolute;left:200px;bottom:10px;><input id="theinput" /><a href="javascript:loadthelist()" style="font-size:2em;color:greenyellow">load the list</a></div><div id="alphabet" style="position:fixed;left:100px;bottom:70px"></div><div id="list" style="position:fixed;left:100px;bottom:110px"></div><div id="thisrecord" style="position:fixed;left:100px;bottom:200px;color:violet"></div>



function next() {var next = document.getElementById("next")
if (next.style.display === "none") {next.style.display = "inline"} else {next.style.display = "none"}}

function getletter(theletter) {
var thelist = document.getElementById("theinput").value.split(",")
var theletterlist = ""
for (var i = 0; i < thelist.length; i = i + 1) {
if (thelist[i].split("/")[thelist[i].split("/").length - 1].split("c")[0][0] === theletter) {
theletterlist = theletterlist + thelist[i]
if (i < thelist.length - 1) {theletterlist = theletterlist + ","}}} return theletterlist}

function gettheletters() {
var a = "a,b,c,d,e,f,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",")
var theletters = ""
for (var i = 0; i < a.length; i = i + 1) {
var thecode = '<a href=




I want to list pattern keywords for each pattern, and I'm listing patterns, so ...

And I'm toying with the idea of listing patterns as spans, in a kind of HTML database ...

<span class="pattern" symbol=""><span class="record"></span><span class="keywords"></span>
</span>

<span id="thepatterns">
<span class="pattern"><span class="record"></span><span class="keywords"></span>
</span>
</span>

var thepatternlist = document.getElementsByClassName("pattern")
hmm
var thepatternlist = document.querySelectorAll(" #patterns .pattern .record")

var thepattern = document.querySelector("#patterns .pattern [symbol=SYM]")

if I then want to add a keyword to the record for a pattern

var thenewkeyword = "keyword"
var theselectors = '#patterns .pattern [symbol=SYM] .keywords'
var thepatternskeywords = document.querySelector(theselectors)
thepatternskeywords = thepatternskeywords + thenewkeyword

building the database

let var thelist be a list of records where a record is a pattern identifier
consisting of a symbol and a date and time code, so pi,pi,pi ...
var thelistarray = thelist.split(",")
var therecords = ""
for (var i = 0; i < thelistarray.length; i = i + 1) {
var pi = thelistarray[i]
therecords = therecords + '<span class="pattern" symbol="' + thesymbol(pi) + '">'
therecords = therecords + '<span class="record">' + pi + '</span>'
therecords = therecords + '<span class="keywords"></span></span>'}
document.getElementById("thepatterns").innerHTML = therecords
oh my god that's so much easier



<!--creating a database element-->
<span id="thedatabase"></span>
<!--creating the textarea-->
<textarea></textarea>
<script>
function addarecord(pi) {
var thedatabase = document.getElementById("thedatabase")
var thetextarea = document.querySelector("textarea")
thetextarrea.value = thedatabase.innerHTML
var new = '<span class="pattern" symbol="' + thesymbol(pi) + '">'
new = new + '<span class="record">' + pi + '</span>'
new = new + '<span class="labels"></span>'
// assuming labels will be added later
thetextarea.value = thetextarea.value + new
// scraaaatch
thedatabase.innerHTML = thedatabase.innerHTML + new // ?}
// funny it should appear to be even simpler once again
</script>
<div onmouseover="new()"></div> // style it later
<script>
function new() {
var thedatabase = document.getElementById("thedatabase")
var thetextarea = document.querySelector("textarea")
var pi = thetextarea.value
addarecord(pi)}
</script>




No comments:

Post a Comment