Warning: session_start(): open(/var/lib/php/sessions/sess_critj5pqjpdjfa8prdm77dbtun, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass AbstractTickerPainter extends ScaledDiagram {
// how many lines are drawn to indicate percent changes
settable double percentLineDistance = 0.1;
settable bool drawPercentLines = true;
new L positions;
void drawPercentLines(Graphics2D g) {
if (!drawPercentLines) ret;
double percentStep = center(verticalRange)*percentLineDistance/100;
for (double y = verticalRange.start; y <= verticalRange.end; y += percentStep) {
var yy = iround(yToScreen(y));
drawLine(g, 0, yy, w-1, yy, Color.gray);
}
}
void drawPositions(Graphics2D g) {
for (position : positions) {
var time = position.openingTime();
var price = position.openingPrice();
var x = xToScreen(time);
var y = yToScreen(price);
//bool green = position.relativeValue() > 0;
bool gren = position.isLong();
var color = colorFromHex(green ? "1da2b4" : "f1493f");
// Mark opening point
fillRect(g, rectAroundPt(iround(x), iround(y), 10), color);
if (not(position.isOpen())) {
time = position.closingTime();
price = position.closingPrice();
var x2 = xToScreen(time);
var y2 = yToScreen(price);
drawArrowBetweenPoints(g, toPt_round(doublePt(x, y)), toPt_round(doublePt(x2, y2)), color);
}
}
}
}