new properties
This commit is contained in:
1 parent
330b530145
commit
7eb3ce7d09
2 files changed
+33
-10
No files matched your search
+18
-4
@@ -331,6 +331,7 @@
|
||||
let currentDate = new Date(farLeftDate.valueOf());
|
||||
|
||||
bands = [];
|
||||
let lastBand
|
||||
|
||||
while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) {
|
||||
|
||||
@@ -356,6 +357,14 @@
|
||||
band.standardDeviation = dailyFile[i][3];
|
||||
band.deviation = dailyFile[i][4];
|
||||
|
||||
if (lastBand !== undefined) {
|
||||
if (lastBand.movingAverage > band.movingAverage) { band.direction = "Down" }
|
||||
if (lastBand.movingAverage < band.movingAverage) { band.direction = "Up" }
|
||||
if (lastBand.movingAverage === band.movingAverage) { band.direction = "Side" }
|
||||
}
|
||||
|
||||
lastBand = band
|
||||
|
||||
if (
|
||||
(band.begin >= farLeftDate.valueOf() && band.end <= farRightDate.valueOf()) &&
|
||||
(band.begin >= coordinateSystem.min.x && band.end <= coordinateSystem.max.x)
|
||||
@@ -386,13 +395,9 @@
|
||||
if (bands[0].begin > lowerEnd || bands[bands.length - 1].end < upperEnd) {
|
||||
|
||||
setTimeout(recalculate, 2000);
|
||||
|
||||
//console.log("File missing while calculating bands, scheduling a recalculation in 2 seconds.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//console.log("Olivia > recalculateUsingDailyFiles > total bands generated : " + bands.length);
|
||||
|
||||
} catch (err) {
|
||||
|
||||
@@ -417,6 +422,7 @@
|
||||
rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5);
|
||||
|
||||
bands = [];
|
||||
let lastBand
|
||||
|
||||
for (let i = 0; i < marketFile.length; i++) {
|
||||
|
||||
@@ -434,6 +440,14 @@
|
||||
band.standardDeviation = marketFile[i][3];
|
||||
band.deviation = marketFile[i][4];
|
||||
|
||||
if (lastBand !== undefined) {
|
||||
if (lastBand.movingAverage > band.movingAverage) { band.direction = "Down" }
|
||||
if (lastBand.movingAverage < band.movingAverage) { band.direction = "Up" }
|
||||
if (lastBand.movingAverage === band.movingAverage) { band.direction = "Side" }
|
||||
}
|
||||
|
||||
lastBand = band
|
||||
|
||||
if (
|
||||
(band.begin >= leftDate.valueOf() && band.end <= rightDate.valueOf()) &&
|
||||
(band.begin >= coordinateSystem.min.x && band.end <= coordinateSystem.max.x)
|
||||
|
||||
+15
-6
@@ -120,8 +120,8 @@ function newMastersPlottersBollingerBandsBollingerBandsBollingerBandsPanel () {
|
||||
|
||||
/* Extra bounderies due to constrained space */
|
||||
|
||||
const upperLimit = frameTitleHeight + frameBodyHeight * 0.15;
|
||||
const downLimit = frameTitleHeight + frameBodyHeight * 0.85;
|
||||
const upperLimit = frameTitleHeight + frameBodyHeight * 0.25;
|
||||
const downLimit = frameTitleHeight + frameBodyHeight * 0.75;
|
||||
|
||||
if (bandPoint1.y > downLimit) { bandPoint1.y = downLimit; }
|
||||
if (bandPoint4.y > downLimit) { bandPoint4.y = downLimit; }
|
||||
@@ -201,11 +201,20 @@ function newMastersPlottersBollingerBandsBollingerBandsBollingerBandsPanel () {
|
||||
|
||||
let y;
|
||||
|
||||
printLabel('Moving Average', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
printLabel(currentBand.innerBand.movingAverage, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
|
||||
printLabel('Deviation', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
printLabel(currentBand.innerBand.deviation, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
if (currentBand.innerBand.direction !== undefined) {
|
||||
printLabel('Direction', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
printLabel(currentBand.innerBand.direction, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
}
|
||||
|
||||
printLabel('Moving Average', X_AXIS, frameTitleHeight + frameBodyHeight * 0.15, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
printLabel(currentBand.innerBand.movingAverage, X_AXIS, frameTitleHeight + frameBodyHeight * 0.20, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
|
||||
printLabel('Deviation', X_AXIS, frameTitleHeight + frameBodyHeight * 0.85, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
printLabel(currentBand.innerBand.deviation, X_AXIS, frameTitleHeight + frameBodyHeight * 0.80, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
|
||||
printLabel('Standard Deviation', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
printLabel(currentBand.innerBand.standardDeviation, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user