persistable sclass TradingRun extends TradingCandle is IntSize { settable new L candles; *(Iterable candles) { fOr (c : candles) add(c); } void add aka addCandle(TradingCandle candle) { candles.add(candle); addValue(candle.start, candle.startTime); addValue(candle.end, candle.endTime); projectedEndTime(candle.projectedEndTime); if (candle.min < min) min = candle.min; if (candle.max > max) max = candle.max; } public int size() { ret l(candles); } double changePercent() { ret asPercentIncrease(changeRatio()); } S myType() { ret "run length " + n2(candles) + ", change " + formatDouble2X(changePercent()) + "%"; } // TODO: This really doesn't fit anymore bool isCompatibleCandle(TradingCandle candle) { ret candle.isWhite() || eq(candle.colorText(), colorText()); } public TradingRun clone() { ret shallowClone(this).candles(map(candles, -> .clone())); } TradingCandle asCandle() { ret shallowCloneToClass(TradingCandle, this); } }