|
|
|
|
@@ -1,11 +1,82 @@
|
|
|
|
|
|
|
|
|
|
API_KEY = localStorage.getItem("api-key")
|
|
|
|
|
var chart = null
|
|
|
|
|
// var colors = ["#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#00425A","#B5D5C5","#e61957","#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#00425A","#B5D5C5","#e61957"]
|
|
|
|
|
// var reset_colors = ["#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#00425A","#B5D5C5","#e61957","#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#00425A","#B5D5C5","#e61957"]
|
|
|
|
|
var colors = ["#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#B5D5C5","#e61957","#7B0E60","#9B2888","#BD38A0","#A30F68","#6E0B50","#CA2183","#E6319B","#A04C54","#643848","#CA7474","#E68D8D","#4F9C34","#3B7128","#73DF4D","#95EF65","#A857A4","#824690","#D087CC","#E2A1DF","#79711B","#635D17","#99912B","#B1A73D","#3779C9","#2B68B3","#5599ED","#77A9F7","#004C67","#00687D","#A1C6B5","#8CC6A5","#C9E6D5","#E4F6EA","#D2144A","#A60F3B","#FA2463","#FF3775"];
|
|
|
|
|
var reset_colors = ["#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#B5D5C5","#e61957","#7B0E60","#9B2888","#BD38A0","#A30F68","#6E0B50","#CA2183","#E6319B","#A04C54","#643848","#CA7474","#E68D8D","#4F9C34","#3B7128","#73DF4D","#95EF65","#A857A4","#824690","#D087CC","#E2A1DF","#79711B","#635D17","#99912B","#B1A73D","#3779C9","#2B68B3","#5599ED","#77A9F7","#004C67","#00687D","#A1C6B5","#8CC6A5","#C9E6D5","#E4F6EA","#D2144A","#A60F3B","#FA2463","#FF3775"];
|
|
|
|
|
|
|
|
|
|
//puvodni mene vyrazne barvy
|
|
|
|
|
// var colors = ["#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#B5D5C5","#e61957","#7B0E60","#9B2888","#BD38A0","#A30F68","#6E0B50","#CA2183","#E6319B","#A04C54","#643848","#CA7474","#E68D8D","#4F9C34","#3B7128","#73DF4D","#95EF65","#A857A4","#824690","#D087CC","#FF3775","#E2A1DF","#79711B","#635D17","#99912B","#B1A73D","#3779C9","#A60F3B","#2B68B3","#5599ED","#77A9F7","#004C67","#00687D","#A1C6B5","#8CC6A5","#C9E6D5","#E4F6EA","#D2144A","#FA2463","#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#B5D5C5","#e61957","#7B0E60","#9B2888","#BD38A0","#A30F68","#6E0B50","#CA2183","#E6319B","#A04C54","#643848","#CA7474","#E68D8D","#4F9C34","#3B7128","#73DF4D","#95EF65","#A857A4","#824690","#D087CC","#FF3775","#E2A1DF","#79711B","#635D17","#99912B","#B1A73D","#3779C9","#A60F3B","#2B68B3","#5599ED","#77A9F7","#004C67","#00687D","#A1C6B5","#8CC6A5","#C9E6D5","#E4F6EA","#D2144A","#FA2463"];
|
|
|
|
|
// var reset_colors = ["#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#B5D5C5","#e61957","#7B0E60","#9B2888","#BD38A0","#A30F68","#6E0B50","#CA2183","#E6319B","#A04C54","#643848","#CA7474","#E68D8D","#4F9C34","#3B7128","#73DF4D","#95EF65","#A857A4","#824690","#D087CC","#FF3775","#E2A1DF","#79711B","#635D17","#99912B","#B1A73D","#3779C9","#A60F3B","#2B68B3","#5599ED","#77A9F7","#004C67","#00687D","#A1C6B5","#8CC6A5","#C9E6D5","#E4F6EA","#D2144A","#FA2463","#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#B5D5C5","#e61957","#7B0E60","#9B2888","#BD38A0","#A30F68","#6E0B50","#CA2183","#E6319B","#A04C54","#643848","#CA7474","#E68D8D","#4F9C34","#3B7128","#73DF4D","#95EF65","#A857A4","#824690","#D087CC","#FF3775","#E2A1DF","#79711B","#635D17","#99912B","#B1A73D","#3779C9","#A60F3B","#2B68B3","#5599ED","#77A9F7","#004C67","#00687D","#A1C6B5","#8CC6A5","#C9E6D5","#E4F6EA","#D2144A","#FA2463"];
|
|
|
|
|
|
|
|
|
|
// function generateColorPalette(numColors) {
|
|
|
|
|
// const palette = [];
|
|
|
|
|
// let lastColor = null;
|
|
|
|
|
// for (let i = 0; i < numColors; i++) {
|
|
|
|
|
// let color = generateRandomColor();
|
|
|
|
|
// while (isColorDark(color) || areColorsTooSimilar(color, lastColor)) {
|
|
|
|
|
// color = generateRandomColor();
|
|
|
|
|
// }
|
|
|
|
|
// lastColor = color;
|
|
|
|
|
// palette.push(color);
|
|
|
|
|
// }
|
|
|
|
|
// return palette;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// function generateRandomColor() {
|
|
|
|
|
// const letters = '0123456789ABCDEF';
|
|
|
|
|
// let color = '#';
|
|
|
|
|
// for (let i = 0; i < 6; i++) {
|
|
|
|
|
// color += letters[Math.floor(Math.random() * 16)];
|
|
|
|
|
// }
|
|
|
|
|
// return color;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// function areColorsTooSimilar(color1, color2) {
|
|
|
|
|
// if (!color1 || !color2) {
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// // Calculate the color difference
|
|
|
|
|
// const diff = parseInt(color1.substring(1), 16) - parseInt(color2.substring(1), 16);
|
|
|
|
|
// // Define a threshold for color difference (you can adjust this value)
|
|
|
|
|
// const threshold = 500;
|
|
|
|
|
// return Math.abs(diff) < threshold;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// function isColorDark(color) {
|
|
|
|
|
// const hexColor = color.replace("#", "");
|
|
|
|
|
// const r = parseInt(hexColor.substr(0, 2), 16);
|
|
|
|
|
// const g = parseInt(hexColor.substr(2, 2), 16);
|
|
|
|
|
// const b = parseInt(hexColor.substr(4, 2), 16);
|
|
|
|
|
// const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
|
|
|
// return brightness < 128 || brightness > 140; // You can adjust the threshold for what you consider 'dark'
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// colors = generateColorPalette(255)
|
|
|
|
|
// reset_colors = colors
|
|
|
|
|
|
|
|
|
|
// console.log(`"${colors.join("\", \"")}"`);
|
|
|
|
|
|
|
|
|
|
// // pekne vygenrovane pomoci kodu vyse
|
|
|
|
|
var colors = ["#63AA57", "#8F8AB0", "#4CAA4E", "#E24AEE", "#D06AA6", "#7891BA", "#A39A34", "#8A94A2", "#8887A7", "#61BB2F", "#FD569D", "#1EB6E1",
|
|
|
|
|
"#379AC9", "#FD6F2E", "#8C9858", "#39A4A3", "#6D97F4", "#1ECB01", "#FA5B16", "#A6891C", "#48CF10", "#D27B26", "#D56B55", "#FE3AB8", "#E35C51",
|
|
|
|
|
"#EC4FE6", "#E250A3", "#BA618E", "#1BC074", "#C57784", "#888BC5", "#4FA452", "#80885C", "#B97272", "#33BF98", "#B7961D", "#A07284", "#02E54E",
|
|
|
|
|
"#AF7F35", "#F852EF", "#6D955B", "#E0676E", "#F73DEC", "#CE53FD", "#9773D3", "#649E81", "#D062CE", "#AB73E7", "#A4729C", "#E76A07", "#E85CCB",
|
|
|
|
|
"#A16FB1", "#4BB859", "#B25EE2", "#8580CE", "#A275EF", "#AC9245", "#4D988D", "#B672C9", "#4CA96E", "#C9873E", "#5BB147", "#10C783", "#D7647D",
|
|
|
|
|
"#CB893A", "#A586BA", "#28C0A2", "#61A755", "#0EB7C5", "#2DADBC", "#17BB71", "#2BC733", "#2BB890", "#F04EF8", "#699580", "#A88809", "#EB3FF6",
|
|
|
|
|
"#A75ED3", "#859171", "#BB6285", "#81A147", "#AD7CD2", "#65B630", "#C9616C", "#BD5EFA", "#7A9F30", "#2AB6AB", "#FC496A", "#687FC7", "#DB40E7",
|
|
|
|
|
"#07BCE9", "#509F63", "#EC4FDD", "#A079BE", "#C17297", "#E447C2", "#E95AD9", "#9FA01E", "#7E86CF", "#21E316", "#1CABF9", "#17C24F", "#9C9254",
|
|
|
|
|
"#C97994", "#4BA9DA", "#0DD595", "#13BEA8", "#C2855D", "#DF6C13", "#60B370", "#0FC3F6", "#C1830E", "#3AC917", "#0EBBB0", "#CC50B4", "#B768EC",
|
|
|
|
|
"#D47F49", "#B47BC5", "#38ADBD", "#05DC53", "#44CD4E", "#838E65", "#49D70F", "#2DADBE", "#2CB0C9", "#DA703E", "#06B5CA", "#7BAF3E", "#918E79",
|
|
|
|
|
"#2AA5E5", "#C37F5E", "#07B8C9", "#4CBA27", "#E752C6", "#7F93B2", "#4798CD", "#45AA4C", "#4DB666", "#7683A7", "#758685", "#4B9FAD", "#9280FD",
|
|
|
|
|
"#6682DD", "#42ACBE", "#C1609F", "#D850DB", "#649A62", "#54CC22", "#AD81C1", "#BF7A43", "#0FCEA5", "#D06DAF", "#87799B", "#4DA94E", "#2FD654",
|
|
|
|
|
"#07D587", "#21CF0C", "#03CF34", "#42C771", "#D563CD", "#6D9E9A", "#C76C59", "#68B368", "#11BCE5", "#0DCFB3", "#9266D8", "#BF67F6", "#88A04E",
|
|
|
|
|
"#73BE17", "#67B437", "#8586E4", "#9F8749", "#479CA5", "#CC777E", "#4FAF46", "#9D9836", "#918DAF", "#D167B8", "#6F9DA5", "#2BB167", "#16B8BC",
|
|
|
|
|
"#B4861F", "#A08487", "#67B357", "#5CAA5C", "#20CA49", "#D18813", "#15D63F", "#C8618F", "#887E92", "#21C457", "#4EA8CE", "#53BE49", "#5A86D5",
|
|
|
|
|
"#BD7E4E", "#27B0A1", "#33CF42", "#709083", "#38A8DE", "#4CA762", "#1EA4FF", "#DE3EE4", "#70A860", "#39A3C8", "#6BBB39", "#F053F4", "#8C7FB5",
|
|
|
|
|
"#969F21", "#B19841", "#E57148", "#C25DA7", "#6DA979", "#B27D73", "#7F9786", "#41AC99", "#C58848", "#948F9E", "#6BB620", "#81AB3B", "#09DE44",
|
|
|
|
|
"#43A9D2", "#41B0D7", "#20ACAA", "#649FCB", "#CD8345", "#A88669", "#3EA5E7", "#F36A19", "#E06B48", "#8388BD", "#EC6153", "#639082", "#52CA32",
|
|
|
|
|
"#878BAA", "#02BCDB", "#828FD9", "#3DC07F", "#29D46A", "#9C7CC1", "#EB7713", "#F95F6A", "#E25F4C", "#589994", "#D45AB7", "#DE66AB", "#B8715F",
|
|
|
|
|
"#E850F4", "#FB6420", "#C2832C", "#6383C5", "#D57A58", "#EF652C", "#02D71A", "#ED664D", "#60A526"]
|
|
|
|
|
|
|
|
|
|
var reset_colors = colors.slice()
|
|
|
|
|
|
|
|
|
|
var indList = []
|
|
|
|
|
var verticalSeries=null
|
|
|
|
|
@@ -259,7 +330,7 @@ function initialize_chart() {
|
|
|
|
|
//var chartOptions = { width: 1045, height: 600, leftPriceScale: {visible: true}}
|
|
|
|
|
|
|
|
|
|
//TMAVY MOD
|
|
|
|
|
var chartOptions = { width: 1080,
|
|
|
|
|
var chartOptions = { width: 1280,
|
|
|
|
|
height: 600,
|
|
|
|
|
leftPriceScale: {visible: true},
|
|
|
|
|
layout: {
|
|
|
|
|
@@ -483,6 +554,54 @@ function profitLineToggle() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//togle go wide
|
|
|
|
|
function toggleWide() {
|
|
|
|
|
width = 2000;
|
|
|
|
|
const elem = document.getElementById("goWide");
|
|
|
|
|
const msgContainer = document.getElementById("msgContainer");
|
|
|
|
|
const msgContainerInner = document.getElementById("msgContainerInner");
|
|
|
|
|
const clrButton = document.getElementById("clrButton");
|
|
|
|
|
|
|
|
|
|
if (elem.classList.contains("switcher-active-item")) {
|
|
|
|
|
width = 1080;
|
|
|
|
|
msgContainer.removeAttribute("style");
|
|
|
|
|
msgContainerInner.removeAttribute("style");
|
|
|
|
|
clrButton.removeAttribute("style");
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
msgContainer.style.display = "block"
|
|
|
|
|
msgContainerInner.style.display = "none"
|
|
|
|
|
clrButton.style.display = "none"
|
|
|
|
|
}
|
|
|
|
|
elem.classList.toggle("switcher-active-item");
|
|
|
|
|
|
|
|
|
|
if (chart) {
|
|
|
|
|
chart.applyOptions({ width: width});
|
|
|
|
|
chart.timeScale().fitContent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//togle profit line
|
|
|
|
|
function mrkLineToggle() {
|
|
|
|
|
vis = true;
|
|
|
|
|
const elem = document.getElementById("mrkLine");
|
|
|
|
|
if (elem.classList.contains("switcher-active-item")) {
|
|
|
|
|
vis = false;
|
|
|
|
|
}
|
|
|
|
|
elem.classList.toggle("switcher-active-item");
|
|
|
|
|
//v ifu kvuli workaroundu
|
|
|
|
|
if (markersLine) {
|
|
|
|
|
markersLine.applyOptions({
|
|
|
|
|
visible: vis });
|
|
|
|
|
}
|
|
|
|
|
if (slLine) {
|
|
|
|
|
slLine.forEach((series, index, array) => {
|
|
|
|
|
series.applyOptions({
|
|
|
|
|
visible: vis });
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//toggle indiktoru
|
|
|
|
|
function onItemClickedToggle(index) {
|
|
|
|
|
@@ -555,6 +674,46 @@ function populate_indicator_buttons(def) {
|
|
|
|
|
itemEl.addEventListener('click', function(e) {
|
|
|
|
|
profitLineToggle();
|
|
|
|
|
});
|
|
|
|
|
buttonElement.appendChild(itemEl);
|
|
|
|
|
|
|
|
|
|
//button pro toggle fullscreenu
|
|
|
|
|
var itemEl = document.createElement('button');
|
|
|
|
|
itemEl.innerText = "wide"
|
|
|
|
|
itemEl.classList.add('switcher-item');
|
|
|
|
|
itemEl.style.color = "#99912b"
|
|
|
|
|
itemEl.id = "goWide"
|
|
|
|
|
itemEl.addEventListener('click', function(e) {
|
|
|
|
|
toggleWide();
|
|
|
|
|
});
|
|
|
|
|
buttonElement.appendChild(itemEl);
|
|
|
|
|
|
|
|
|
|
// //button pro toggle markeru nakupu/prodeju
|
|
|
|
|
var itemEl = document.createElement('button');
|
|
|
|
|
itemEl.innerText = "mrk"
|
|
|
|
|
itemEl.classList.add('switcher-item');
|
|
|
|
|
itemEl.classList.add('switcher-active-item');
|
|
|
|
|
// if ((activatedButtons) && (!activatedButtons.includes("mrk"))) {
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemEl.style.color = "#99912b"
|
|
|
|
|
itemEl.id = "mrkLine"
|
|
|
|
|
|
|
|
|
|
// // Create an icon element
|
|
|
|
|
// const iconEl = document.createElement('i');
|
|
|
|
|
// // Set the icon class
|
|
|
|
|
// iconEl.classList.add('bi');
|
|
|
|
|
// iconEl.classList.add('bi-rainbow'); // Replace `icon-name` with the name of the icon you want to use
|
|
|
|
|
// // Append the icon element to the button element
|
|
|
|
|
// itemEl.appendChild(iconEl);
|
|
|
|
|
|
|
|
|
|
itemEl.addEventListener('click', function(e) {
|
|
|
|
|
mrkLineToggle();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
buttonElement.appendChild(itemEl);
|
|
|
|
|
|
|
|
|
|
//create plus button to create new button
|
|
|
|
|
|