agregace volume baru, SL optimizace + goalprice
This commit is contained in:
@@ -84,22 +84,37 @@ function transform_data(data) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//pomocne
|
||||
var last_time = 0
|
||||
var time = 0
|
||||
|
||||
data.bars.time.forEach((element, index, array) => {
|
||||
sbars = {};
|
||||
svolume = {};
|
||||
svwap = {};
|
||||
|
||||
sbars["time"] = element;
|
||||
//tento algoritmus z duplicit dela posloupnosti a srovna i pripadne nekonzistence
|
||||
//napr z .911 .911 .912 udela .911 .912 .913
|
||||
//TODO - možná dat do backendu agregatoru
|
||||
if (last_time>=element) {
|
||||
console.log("bars", "problem v case - zarovnano",time, last_time, element)
|
||||
|
||||
data.bars.time[index] = data.bars.time[index-1] + 0.000001
|
||||
}
|
||||
|
||||
last_time = data.bars.time[index]
|
||||
sbars["time"] = data.bars.time[index];
|
||||
sbars["close"] = data.bars.close[index]
|
||||
sbars["open"] = data.bars.open[index]
|
||||
sbars["high"] = data.bars.high[index]
|
||||
sbars["low"] = data.bars.low[index]
|
||||
|
||||
|
||||
svwap["time"] = element
|
||||
svwap["time"] = data.bars.time[index];
|
||||
svwap["value"] = data.bars.vwap[index]
|
||||
|
||||
svolume["time"] = element
|
||||
svolume["time"] = data.bars.time[index];
|
||||
svolume["value"] = data.bars.volume[index]
|
||||
|
||||
bars.push(sbars)
|
||||
@@ -107,6 +122,7 @@ function transform_data(data) {
|
||||
volume.push(svolume)
|
||||
});
|
||||
transformed["bars"] = bars
|
||||
//console.log(bars)
|
||||
transformed["vwap"] = vwap
|
||||
transformed["volume"] = volume
|
||||
var bars = []
|
||||
@@ -585,7 +601,7 @@ function chart_indicators(data, visible, offset) {
|
||||
|
||||
//DEBUG
|
||||
// if (key == 'tick_price') {
|
||||
// console.log("problem tu",JSON.stringify(items))
|
||||
// console.log("problem tu",JSON.stringify(items,null,2))
|
||||
// }
|
||||
//add data
|
||||
obj.series.setData(items)
|
||||
|
||||
@@ -581,6 +581,21 @@ function toggleWide() {
|
||||
}
|
||||
}
|
||||
|
||||
//togle profit line
|
||||
function toggleVolume() {
|
||||
vis = true;
|
||||
const elem = document.getElementById("volToggle");
|
||||
if (elem.classList.contains("switcher-active-item")) {
|
||||
vis = false;
|
||||
}
|
||||
elem.classList.toggle("switcher-active-item");
|
||||
//v ifu kvuli workaroundu
|
||||
if (volumeSeries) {
|
||||
volumeSeries.applyOptions({
|
||||
visible: vis });
|
||||
}
|
||||
}
|
||||
|
||||
//togle profit line
|
||||
function mrkLineToggle() {
|
||||
vis = true;
|
||||
@@ -613,15 +628,19 @@ function onItemClickedToggle(index) {
|
||||
elem.classList.toggle("switcher-active-item");
|
||||
//v ifu kvuli workaroundu
|
||||
if (indList[index].series) {
|
||||
indList[index].series.applyOptions({
|
||||
visible: vis });
|
||||
//console.log(indList[index].name, indList[index].series)
|
||||
indList[index].series.applyOptions({
|
||||
visible: vis });
|
||||
}
|
||||
//zatim takto workaround, pak vymyslet systemove pro vsechny tickbased indikatory
|
||||
if (indList[index].name == "tick_price") {
|
||||
tickIndicatorList = ["tick_price", "tick_volume"]
|
||||
if (tickIndicatorList.includes(indList[index].name)) {
|
||||
if (!vis && indList[index].series) {
|
||||
//console.log("pred", indList[index].name, indList[index].series)
|
||||
chart.removeSeries(indList[index].series)
|
||||
chart.timeScale().fitContent();
|
||||
indList[index].series = null
|
||||
//console.log("po", indList[index].name, indList[index].series)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,6 +706,18 @@ function populate_indicator_buttons(def) {
|
||||
});
|
||||
buttonElement.appendChild(itemEl);
|
||||
|
||||
//button pro toggle fullscreenu
|
||||
var itemEl = document.createElement('button');
|
||||
itemEl.innerText = "vol"
|
||||
itemEl.classList.add('switcher-item');
|
||||
itemEl.classList.add('switcher-active-item');
|
||||
itemEl.style.color = "#99912b"
|
||||
itemEl.id = "volToggle"
|
||||
itemEl.addEventListener('click', function(e) {
|
||||
toggleVolume();
|
||||
});
|
||||
buttonElement.appendChild(itemEl);
|
||||
|
||||
// //button pro toggle markeru nakupu/prodeju
|
||||
var itemEl = document.createElement('button');
|
||||
itemEl.innerText = "mrk"
|
||||
|
||||
Reference in New Issue
Block a user